[CalendarServer-changes] [403] CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/ directory/resource.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 9 12:16:24 PST 2006


Revision: 403
          http://trac.macosforge.org/projects/calendarserver/changeset/403
Author:   wsanchez at apple.com
Date:     2006-11-09 12:16:23 -0800 (Thu, 09 Nov 2006)

Log Message:
-----------
Add principalForUser() to DirectoryPrincipalProvisioningResource.
Implement principalCollections() because we can do it faster.

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

Modified: CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/resource.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/resource.py	2006-11-08 22:41:28 UTC (rev 402)
+++ CalendarServer/branches/users/wsanchez/provisioning/twistedcaldav/directory/resource.py	2006-11-09 20:16:23 UTC (rev 403)
@@ -27,6 +27,7 @@
 ]
 
 from twisted.python import log
+from twisted.internet.defer import succeed
 from twisted.web2 import responsecode
 from twisted.web2.http import HTTPError
 from twisted.web2.dav.static import DAVFile
@@ -77,6 +78,9 @@
     def listChildren(self):
         return self.directory.recordTypes()
 
+    def principalForUser(self, user):
+        return self.getChild("user").getChild(user)
+
 class DirectoryPrincipalTypeResource (ReadOnlyResourceMixIn, CalendarPrincipalCollectionResource, DAVFile):
     """
     Collection resource which provisions directory principals of a specific type as its children.
@@ -87,6 +91,7 @@
 
         self.directory = parent.directory
         self.recordType = name
+        self._parent = parent
 
     def createSimilarFile(self, path):
         raise HTTPError(responsecode.NOT_FOUND)
@@ -113,6 +118,9 @@
     def listChildren(self):
         return [record.shortName for record in self.directory.listRecords(self.recordType)]
 
+    def principalCollections(self, request):
+        return self._parent.principalCollections(request)
+
 class DirectoryPrincipalResource (ReadOnlyResourceMixIn, CalendarPrincipalFile):
     """
     Directory principal resource.
@@ -123,6 +131,7 @@
         self.directory = parent.directory
         self.recordType = parent.recordType
         self.shortName = name
+        self._parent = parent
 
     ##
     # ACL
@@ -137,6 +146,9 @@
     def groupMemberships(self):
         raise NotImplementedError()
 
+    def principalCollections(self, request):
+        return self._parent.principalCollections(request)
+
     ##
     # CalDAV
     ##

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


More information about the calendarserver-changes mailing list