Skip to content

Commit

Permalink
Merge 444c652 into d4e4505
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens authored Oct 18, 2016
2 parents d4e4505 + 444c652 commit 7baf506
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ History
1.0b3 (unreleased)
------------------

- Nothing changed yet.
- Fix missing paging in UGM group mapping method ``member_ids``.
[jensens]


1.0b2 (2016-09-09)
Expand All @@ -14,7 +15,7 @@ History
[jensens]

- Paginate LDAP node ``__iter__``.
[jensens, rnix]
[jensens, rnix]

1.0b1 (31.12.2015)
------------------
Expand Down
16 changes: 10 additions & 6 deletions src/node/ext/ldap/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,25 @@ def read_env(layer):
slapdconf_template = """\
%(schema)s
logfile %(confdir)s/log
loglevel 256
logfile %(confdir)s/log
loglevel 256
pidfile %(confdir)s/slapd.pid
argsfile %(confdir)s/slapd.args
database bdb
suffix "%(suffix)s"
rootdn "%(binddn)s"
rootpw %(bindpw)s
directory %(dbdir)s
rootpw %(bindpw)s
directory %(dbdir)s
# Indices to maintain
index objectClass eq
index objectClass eq
overlay memberof
overlay memberof
# for testing set a lower size_limit in order to be able to catch mismatches
sizelimit 3
"""


Expand Down
24 changes: 19 additions & 5 deletions src/node/ext/ldap/ugm/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __repr__(self):

__str__ = __repr__


ACCOUNT_EXPIRED = AccountExpired()


Expand Down Expand Up @@ -316,11 +317,24 @@ def member_ids(self):
users = ugm.users
criteria = {'memberOf': self.context.DN}
attrlist = [users._key_attr]
res = users.context.search(
criteria=criteria,
attrlist=attrlist
)
return [att[users._key_attr][0] for _, att in res]
cookie = ''
matches = []
while True:
try:
batch_matches, cookie = users.context.search(
criteria=criteria,
attrlist=attrlist,
page_size=users.context._page_size,
cookie=cookie,
)
except ValueError:
return []
matches += [
att[users._key_attr][0] for _, att in batch_matches
]
if not cookie:
break
return matches
ret = list()
members = self.context.attrs.get(self._member_attribute, list())
for member in members:
Expand Down

0 comments on commit 7baf506

Please sign in to comment.