[CalendarServer-changes] [5547] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 29 13:46:51 PDT 2010


Revision: 5547
          http://trac.macosforge.org/projects/calendarserver/changeset/5547
Author:   cdaboo at apple.com
Date:     2010-04-29 13:46:49 -0700 (Thu, 29 Apr 2010)
Log Message:
-----------
Support CS:allowed-sharing-modes property.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/customxml.py
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py	2010-04-29 20:39:11 UTC (rev 5546)
+++ CalendarServer/trunk/twistedcaldav/customxml.py	2010-04-29 20:46:49 UTC (rev 5547)
@@ -352,6 +352,7 @@
     namespace = calendarserver_namespace
     name = "first-name"
     protected = True
+    hidden = True
 
 class LastNameProperty (davxml.WebDAVTextElement):
     """
@@ -360,6 +361,7 @@
     namespace = calendarserver_namespace
     name = "last-name"
     protected = True
+    hidden = True
 
 class EmailAddressProperty (davxml.WebDAVTextElement):
     """
@@ -368,6 +370,7 @@
     namespace = calendarserver_namespace
     name = "email-address"
     protected = True
+    hidden = True
 
 class EmailAddressSet (davxml.WebDAVElement):
     """
@@ -568,6 +571,7 @@
     namespace = calendarserver_namespace
     name = "record-type"
     protected = True
+    hidden = True
 
 class AutoSchedule (davxml.WebDAVTextElement):
     """
@@ -662,6 +666,25 @@
     namespace = calendarserver_namespace
     name = "birthday"
 
+class AllowedSharingModes (davxml.WebDAVElement):
+    namespace = calendarserver_namespace
+    name = "allowed-sharing-modes"
+    protected = True
+    hidden = True
+
+    allowed_children = {
+        (calendarserver_namespace, "can-be-shared" )    : (0, 1),
+        (calendarserver_namespace, "can-be-published" ) : (0, 1),
+    }
+
+class CanBeShared (davxml.WebDAVEmptyElement):
+    namespace = calendarserver_namespace
+    name = "can-be-shared"
+
+class CanBePublished (davxml.WebDAVEmptyElement):
+    namespace = calendarserver_namespace
+    name = "can-be-published"
+
 class InviteShare (davxml.WebDAVElement):
     namespace = calendarserver_namespace
     name = "share"

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2010-04-29 20:39:11 UTC (rev 5546)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2010-04-29 20:46:49 UTC (rev 5547)
@@ -181,7 +181,11 @@
             
         if config.Sharing.Enabled:
             if config.Sharing.Calendars.Enabled and self.isCalendarCollection():
-                baseProperties += (customxml.Invite.qname(),)
+                baseProperties += (
+                    customxml.Invite.qname(),
+                    customxml.AllowedSharingModes.qname(),
+                )
+
             elif config.Sharing.AddressBooks.Enabled and self.isAddressBookCollection():
                 baseProperties += (customxml.Invite.qname(),)
                 
@@ -358,9 +362,14 @@
             ))
 
         elif qname == customxml.Invite.qname():
-            result = (yield self.inviteProperty(request))
-            returnValue(result)
+            if config.Sharing.Enabled and config.Sharing.Calendars.Enabled and self.isCalendarCollection():
+                result = (yield self.inviteProperty(request))
+                returnValue(result)
 
+        elif qname == customxml.AllowedSharingModes.qname():
+            if config.Sharing.Enabled and config.Sharing.Calendars.Enabled and self.isCalendarCollection():
+                returnValue(customxml.AllowedSharingModes(customxml.CanBeShared()))
+
         result = (yield super(CalDAVResource, self).readProperty(property, request))
         returnValue(result)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100429/fcd80f4c/attachment-0001.html>


More information about the calendarserver-changes mailing list