[CalendarServer-changes] [532]
CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 20 20:13:21 PST 2006
Revision: 532
http://trac.macosforge.org/projects/calendarserver/changeset/532
Author: cdaboo at apple.com
Date: 2006-11-20 20:13:21 -0800 (Mon, 20 Nov 2006)
Log Message:
-----------
Fix principal collection lookup. Also make sure calendar home resource can quickly find its principal.
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/directory.py
CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/idirectory.py
CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/resource.py
CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/directory.py 2006-11-21 04:11:45 UTC (rev 531)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/directory.py 2006-11-21 04:13:21 UTC (rev 532)
@@ -70,6 +70,9 @@
else:
raise UnauthorizedLogin("Incorrect credentials for %s" % (user,))
+ def setProvisioningResource(self, provisioner):
+ self.provisioner = provisioner
+
class DirectoryRecord(object):
implements(IDirectoryRecord)
@@ -108,6 +111,14 @@
def verifyCredentials(self, credentials):
return False
+ def principalResource(self):
+ """
+ Return the principal resource that was provisioned from
+ this directory record.
+ @return: L{CalendarPrincipalResource}
+ """
+ return self.service.provisioner.principalForRecord(self)
+
class DirectoryError(RuntimeError):
"""
Generic directory error.
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/idirectory.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/idirectory.py 2006-11-21 04:11:45 UTC (rev 531)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/idirectory.py 2006-11-21 04:13:21 UTC (rev 532)
@@ -90,3 +90,10 @@
@return: C{True} if the given credentials match this record,
C{False} otherwise.
"""
+
+ def principalResource():
+ """
+ Return the principal resource that was provisioned from
+ this directory record.
+ @return: L{CalendarPrincipalResource}
+ """
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/resource.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/resource.py 2006-11-21 04:11:45 UTC (rev 531)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/resource.py 2006-11-21 04:13:21 UTC (rev 532)
@@ -56,15 +56,8 @@
self._url = url
self.directory = IDirectoryService(directory)
+ self.directory.setProvisioningResource(self)
- # FIXME: Smells like a hack
- directory.principalCollection = self
-
- # FIXME: Move this to __init__ after we remove the directory proxy hack from repository.py.
- def _initChildren(self):
- if len(self.putChildren) > 0:
- return
-
# Create children
for name in self.directory.recordTypes():
child_fp = self.fp.child(name)
@@ -82,7 +75,6 @@
raise HTTPError(responsecode.NOT_FOUND)
def getChild(self, name):
- self._initChildren()
# This avoids finding case variants of put children on case-insensitive filesystems.
if name not in self.putChildren and name.lower() in (x.lower() for x in self.putChildren):
return None
@@ -90,7 +82,6 @@
return self.putChildren.get(name, None)
def listChildren(self):
- self._initChildren()
return self.putChildren.keys()
def principalForUser(self, user):
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py 2006-11-21 04:11:45 UTC (rev 531)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/static.py 2006-11-21 04:13:21 UTC (rev 532)
@@ -465,11 +465,6 @@
def listChildren(self):
return self.directory.recordTypes()
- def principalCollections(self, request):
- # FIXME: directory.principalCollection smells like a hack
- # See DirectoryPrincipalProvisioningResource.__init__()
- return self.directory.principalCollection.principalCollections(request)
-
def homeForDirectoryRecord(self, record):
return self.getChild(record.recordType).getChild(record.shortName)
@@ -522,9 +517,6 @@
def listChildren(self):
return (record.shortName for record in self.directory.listRecords(self.recordType))
- def principalCollections(self, request):
- return self._parent.principalCollections(request)
-
class CalendarHomeFile (CalDAVFile):
"""
L{CalDAVFile} calendar home collection resource.
@@ -578,9 +570,9 @@
##
def defaultAccessControlList(self):
- # FIXME: directory.principalCollection smells like a hack
- # See DirectoryPrincipalProvisioningResource.__init__()
- myPrincipal = self._parent._parent.directory.principalCollection.principalForRecord(self.record)
+ # Map from the record to the directory service, then to the principal
+ # provisioning resource then to the principal.
+ myPrincipal = self.record.principalResource()
return davxml.ACL(
# Read access for authenticated users.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061120/1734fbf8/attachment.html
More information about the calendarserver-changes
mailing list