Change max size of LDAP pages and add filtering to reduce attributes returned
This commit is contained in:
parent
f5a854c189
commit
1cfc4a8341
1 changed files with 5 additions and 3 deletions
|
@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
_DEFAULT_NETWORK_TIMEOUT = 10.0 # seconds
|
||||
_DEFAULT_TIMEOUT = 10.0 # seconds
|
||||
_DEFAULT_PAGE_SIZE = 500
|
||||
_DEFAULT_PAGE_SIZE = 1000
|
||||
|
||||
|
||||
class LDAPConnectionBuilder(object):
|
||||
|
@ -276,13 +276,15 @@ class LDAPUsers(FederatedUsers):
|
|||
cookie='')
|
||||
|
||||
search_flt = '(memberOf=%s,%s)' % (group_dn, self._base_dn)
|
||||
attributes = [self._uid_attr, self._email_attr]
|
||||
|
||||
for user_search_dn in self._user_dns:
|
||||
# Conduct the initial search for users that are a member of the group.
|
||||
if disable_pagination:
|
||||
msgid = conn.search(user_search_dn, ldap.SCOPE_SUBTREE, search_flt)
|
||||
msgid = conn.search(user_search_dn, ldap.SCOPE_SUBTREE, search_flt, attrlist=attributes)
|
||||
else:
|
||||
msgid = conn.search_ext(user_search_dn, ldap.SCOPE_SUBTREE, search_flt, serverctrls=[lc])
|
||||
msgid = conn.search_ext(user_search_dn, ldap.SCOPE_SUBTREE, search_flt, serverctrls=[lc],
|
||||
attrlist=attributes)
|
||||
|
||||
while True:
|
||||
if disable_pagination:
|
||||
|
|
Reference in a new issue