Revision
866
Author
cdaboo@apple.com
Date
2006-12-20 10:54:57 -0800 (Wed, 20 Dec 2006)

Log Message

Provision the proxy principal collections below each primary principal.

Modified Paths

Diff

Modified: CalendarServer/branches/users/cdaboo/cuproxy-857/twistedcaldav/customxml.py (865 => 866)


--- CalendarServer/branches/users/cdaboo/cuproxy-857/twistedcaldav/customxml.py	2006-12-20 18:54:40 UTC (rev 865)
+++ CalendarServer/branches/users/cdaboo/cuproxy-857/twistedcaldav/customxml.py	2006-12-20 18:54:57 UTC (rev 866)
@@ -52,6 +52,22 @@
     def getValue(self):
         return str(self)
 
+class CalendarProxyRead (davxml.WebDAVEmptyElement):
+    """
+    A read-only calendar user proxy principal resource.
+    (Apple Extension to CalDAV)
+    """
+    namespace = calendarserver_namespace
+    name = "calendar-proxy-read"
+
+class CalendarProxyWrite (davxml.WebDAVEmptyElement):
+    """
+    A read-write calendar user proxy principal resource.
+    (Apple Extension to CalDAV)
+    """
+    namespace = calendarserver_namespace
+    name = "calendar-proxy-write"
+
 class TwistedCalendarPrincipalURI(davxml.WebDAVTextElement):
     """
     Contains the calendarPrincipalURI value for a directory record corresponding to a principal.
@@ -183,3 +199,5 @@
 davxml.ResourceType.dropboxhome = davxml.ResourceType(davxml.Collection(), DropBoxHome())
 davxml.ResourceType.dropbox = davxml.ResourceType(davxml.Collection(), DropBox())
 davxml.ResourceType.notifications = davxml.ResourceType(davxml.Collection(), Notifications())
+davxml.ResourceType.calendarproxyread = davxml.ResourceType(davxml.Principal(), davxml.Collection(), CalendarProxyRead())
+davxml.ResourceType.calendarproxywrite = davxml.ResourceType(davxml.Principal(), davxml.Collection(), CalendarProxyWrite())

Modified: CalendarServer/branches/users/cdaboo/cuproxy-857/twistedcaldav/directory/principal.py (865 => 866)


--- CalendarServer/branches/users/cdaboo/cuproxy-857/twistedcaldav/directory/principal.py	2006-12-20 18:54:40 UTC (rev 865)
+++ CalendarServer/branches/users/cdaboo/cuproxy-857/twistedcaldav/directory/principal.py	2006-12-20 18:54:57 UTC (rev 866)
@@ -37,6 +37,8 @@
 from twisted.web2.dav import davxml
 from twisted.web2.dav.util import joinURL
 
+from twistedcaldav.config import config
+from twistedcaldav.calendaruserproxy import CalendarUserProxyPrincipalResource
 from twistedcaldav.extensions import ReadOnlyResourceMixIn, DAVFile
 from twistedcaldav.resource import CalendarPrincipalCollectionResource, CalendarPrincipalResource
 from twistedcaldav.static import AutoProvisioningFileMixIn
@@ -426,6 +428,29 @@
         else:
             return None
 
+    ##
+    # Static
+    ##
+
+    def createSimilarFile(self, path):
+        log.err("Attempt to create clone %r of resource %r" % (path, self))
+        raise HTTPError(responsecode.NOT_FOUND)
+
+    def getChild(self, name, record=None):
+        if name == "":
+            return self
+
+        if config.CalendarUserProxyEnabled and name in ("calendar-proxy-read", "calendar-proxy-write"):
+            return CalendarUserProxyPrincipalResource(self.fp.child(name).path, self, name)
+        else:
+            return None
+
+    def listChildren(self):
+        if config.CalendarUserProxyEnabled:
+            return ("calendar-proxy-read", "calendar-proxy-write")
+        else:
+            return ()
+
 ##
 # Utilities
 ##