[CalendarServer-changes] [445] CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/ directory/appleopendirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 13 18:49:31 PST 2006


Revision: 445
          http://trac.macosforge.org/projects/calendarserver/changeset/445
Author:   wsanchez at apple.com
Date:     2006-11-13 18:49:31 -0800 (Mon, 13 Nov 2006)

Log Message:
-----------
Implement groups()

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py

Modified: CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py	2006-11-14 02:00:20 UTC (rev 444)
+++ CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/appleopendirectory.py	2006-11-14 02:49:31 UTC (rev 445)
@@ -137,14 +137,14 @@
         return self._records[recordType]
 
     def listRecords(self, recordType):
-        return self._cacheRecords(recordType).values()
+        return self._cacheRecords(recordType).itervalues()
 
     def recordWithShortName(self, recordType, shortName):
         return self._cacheRecords(recordType).get(shortName, None)
 
     def recordWithGUID(self, guid):
         for recordType in self.recordTypes():
-            for record in self._cacheRecords(recordType).values():
+            for record in self._cacheRecords(recordType).itervalues():
                 if record.guid == guid:
                     return record
         return None
@@ -204,9 +204,9 @@
                 yield record
 
     def groups(self):
-        # FIXME:
-        # Need an API here from opendirectory which finds all groups containing this member
-        raise NotImplementedError("OpenDirectoryRecord.groups()")
+        for group in self.service._cacheRecords("group").itervalues():
+            if self.guid in group._memberGUIDs:
+                yield group
 
     def verifyCredentials(self, credentials):
         if isinstance(credentials, UsernamePassword):

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061113/ce876afb/attachment.html


More information about the calendarserver-changes mailing list