[CalendarServer-users] Users in LDAP: restrictEnabledRecords not working?

tobiasbp tobiasbp at gmail.com
Fri Aug 24 00:09:53 PDT 2012

> Actually, the LDAP implementation for the restrictToGroup feature is pretty broken.  I just checked in a fix:
>   https://trac.calendarserver.org/changeset/9741/CalendarServer/trunk

I replaced the original version of ldapdirectory.py (On Debian Wheezy)
with your new version if ldapdirectory.

Listing my users now throws this error:
Traceback (most recent call last):
  File "/usr/bin/calendarserver_manage_principals", line 32, in <module>
  File "/usr/lib/python2.7/dist-packages/calendarserver/tools/principals.py",
line 250, in main
    config.directory = getDirectory()
  File "/usr/lib/python2.7/dist-packages/calendarserver/tools/util.py",
line 141, in getDirectory
    BaseDirectoryService = namedClass(config.DirectoryService.type)
  File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py",
line 351, in namedObject
    module = namedModule('.'.join(classSplit[:-1]))
  File "/usr/lib/python2.7/dist-packages/twisted/python/reflect.py",
line 339, in namedModule
    topLevel = __import__(name)
  File "/usr/lib/python2.7/dist-packages/twistedcaldav/directory/ldapdirectory.py",
line 59, in <module>
    from twistedcaldav.directory.util import splitIntoBatches
ImportError: cannot import name splitIntoBatches

Looks like the my version of twisted does not have "splitIntoBatches".

Maybe this section in the new code could be rewritten to not use
"splitIntoBatches" for better compatability?:

for batch in splitIntoBatches(valuesToFetch, self.batchSize):
                    fields = []
                    for value in batch:
                        fields.append([attributeToSearch, value,
False, "equals"])
                    result = (yield self.recordsMatchingFields(fields,

Seems like that is the only code using "splitIntoBatches".

More information about the calendarserver-users mailing list