dataflake.org

Home Documentation Software Old Stuff Bug Reporting

Add Entry to: speed and robustness improvement (Resolved)

Issue speed and robustness improvement (bug report)
Posted 2006/01/30 by Wichert Akkerman
In environment which a large number of groups the current searchGroup implementation in ActiveDirectoryMultiPlugin has two problems: it will hit the search result, and doing the filtering of results in python instead of in the LDAP server is slow. Since all PAS plugins seem to be case sensitive both problems can be solved by letting the LDAP server itself do all the filtering. The patch below implements this. Index: ActiveDirectoryMultiPlugin.py =================================================================== --- ActiveDirectoryMultiPlugin.py (revision 1280) +++ ActiveDirectoryMultiPlugin.py (working copy) @@ -367,10 +367,14 @@ elif id is None: id = '' - test_id = id.lower() plugin_id = self.getId() - filt = '(objectClass=%s)' % self.group_class + filt = ['(objectClass=%s)' % self.group_class] + if exact_match: + filt.append('(%s=%s)') % (self.groupid_attr, test_id) + else: + filt.append('(%s=*%s*)') % (self.groupid_attr, test_id) + filt = '(&%s)' % ''.join(filt) delegate = acl._delegate R = delegate.search(acl.groups_base, acl.groups_scope, filter=filt) @@ -380,19 +384,13 @@ groups = R['results'] - if exact_match: - tester = operator.eq - else: - tester = operator.contains - results = [] for group in groups: tmp = {} tmp['title'] = '(Group) ' + group[self.grouptitle_attr][0] id = tmp['id'] = group[self.groupid_attr][0] tmp['pluginid'] = plugin_id - if tester(id.lower(), test_id): - results.append(tmp) + results.append(tmp) if sort_by is not None: results.sort(lambda a, b: cmp( a.get(sort_by, '').lower()


Full name
Email address