9👍
✅
Taken from the updated documentation:
New in version 1.1.
If you need to search in more than one place for a user, you can use
LDAPSearchUnion. This takes multipleLDAPSearch
objects and returns
the union of the results. The precedence of the underlying searches is
unspecified.
import ldap
from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion
AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
LDAPSearch("ou=users,dc=example,dc=com", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"),
LDAPSearch("ou=otherusers,dc=example,dc=com", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"),
)
Source:stackexchange.com