### 聯合搜索
1.1版本中的新功能
如果您需要在多個地方為用戶搜索,則可以使用`LDAPSearchUnion`。 這需要多個LDAPSearch對象并返回結果的聯合。 底層搜索的優先級是未指定的。
~~~
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)"),
)
~~~