[CalendarServer-changes] [3216] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 23 12:54:25 PDT 2008


Revision: 3216
          http://trac.macosforge.org/projects/calendarserver/changeset/3216
Author:   cdaboo at apple.com
Date:     2008-10-23 12:54:24 -0700 (Thu, 23 Oct 2008)
Log Message:
-----------
Update to new caldav scheduling spec privileges.

Modified Paths:
--------------
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/conf/caldavd.plist
    CalendarServer/trunk/twistedcaldav/caldavxml.py
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/freebusyurl.py
    CalendarServer/trunk/twistedcaldav/mail.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/schedule.py
    CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
    CalendarServer/trunk/twistedcaldav/scheduling/itip.py
    CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
    CalendarServer/trunk/twistedcaldav/static.py
    CalendarServer/trunk/twistedcaldav/test/test_options.py

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2008-10-23 19:54:24 UTC (rev 3216)
@@ -476,7 +476,7 @@
         <key>AddressPatterns</key>
         <array>
         </array>
-        <key>OldDraftCompatability</key>
+        <key>OldDraftCompatibility</key>
         <true/>
         <key>DefaultCalendarProvisioned</key>
         <true/>

Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/conf/caldavd.plist	2008-10-23 19:54:24 UTC (rev 3216)
@@ -356,7 +356,7 @@
         <key>AddressPatterns</key>
         <array>
         </array>
-        <key>OldDraftCompatability</key>
+        <key>OldDraftCompatibility</key>
         <true/>
         <key>DefaultCalendarProvisioned</key>
         <true/>

Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -1716,6 +1716,20 @@
     """
     name = "schedule"
     
+class ScheduleDeliver (CalDAVEmptyElement):
+    """
+    Privilege which controls scheduling messages going into the Inbox.
+    (CalDAV-schedule, section x.x.x)
+    """
+    name = "schedule-deliver"
+    
+class ScheduleSend (CalDAVEmptyElement):
+    """
+    Privilege which controls the ability to send scheduling messages.
+    (CalDAV-schedule, section x.x.x)
+    """
+    name = "schedule-send"
+    
 class ScheduleState (CalDAVElement):
     """
     Indicates whether a scheduling message in an inbox has been processed

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/config.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -198,7 +198,7 @@
             "EmailDomain"                : "",    # Domain for mailto calendar user addresses on this server
             "HTTPDomain"                 : "",    # Domain for http calendar user addresses on this server
             "AddressPatterns"            : [],    # Reg-ex patterns to match local calendar user addresses
-            "OldDraftCompatability"      : True,  # Whether to maintain compatibility with non-implicit mode
+            "OldDraftCompatibility"      : True,  # Whether to maintain compatibility with non-implicit mode
             "DefaultCalendarProvisioned" : True,  # Whether the provisioned default calendar is marked as the scheduling default
             "EnablePrivateComments"      : True,  # Private comments from attendees to organizer
         },

Modified: CalendarServer/trunk/twistedcaldav/freebusyurl.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/freebusyurl.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/freebusyurl.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -67,14 +67,18 @@
         self.parent = parent
 
     def defaultAccessControlList(self):
+        privs = (
+            davxml.Privilege(davxml.Read()),
+            davxml.Privilege(caldavxml.ScheduleDeliver()),
+        )
+        if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
+            privs += (davxml.Privilege(caldavxml.Schedule()),)
+
         aces = (
-            # DAV:Read, CalDAV:schedule for all principals (does not include anonymous)
+            # DAV:Read, CalDAV:schedule-deliver for all principals (does not include anonymous)
             davxml.ACE(
                 davxml.Principal(davxml.Authenticated()),
-                davxml.Grant(
-                    davxml.Privilege(davxml.Read()),
-                    davxml.Privilege(caldavxml.Schedule()),
-                ),
+                davxml.Grant(*privs),
                 davxml.Protected(),
             ),
         )

Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -169,14 +169,17 @@
         self.parent = parent
 
     def defaultAccessControlList(self):
+        privs = (
+            davxml.Privilege(davxml.Read()),
+            davxml.Privilege(caldavxml.ScheduleDeliver()),
+        )
+        if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
+            privs += (davxml.Privilege(caldavxml.Schedule()),)
         return davxml.ACL(
-            # DAV:Read, CalDAV:schedule for all principals (includes anonymous)
+            # DAV:Read, CalDAV:schedule-deliver for all principals (includes anonymous)
             davxml.ACE(
                 davxml.Principal(davxml.All()),
-                davxml.Grant(
-                    davxml.Privilege(davxml.Read()),
-                    davxml.Privilege(caldavxml.Schedule()),
-                ),
+                davxml.Grant(*privs),
                 davxml.Protected(),
             ),
         )
@@ -214,7 +217,7 @@
         """
 
         # Check authentication and access controls
-        # yield self.authorize(request, (caldavxml.Schedule(),))
+        # yield self.authorize(request, (caldavxml.ScheduleDeliver(),))
 
         # Inject using the IMIPScheduler.
         scheduler = IMIPScheduler(request, self)

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -70,7 +70,7 @@
 class CalDAVComplianceMixIn(object):
 
     def davComplianceClasses(self):
-        if config.Scheduling["CalDAV"]["OldDraftCompatability"]:
+        if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
             extra_compliance = caldavxml.caldav_full_compliance
         else:
             extra_compliance = caldavxml.caldav_implicit_compliance

Modified: CalendarServer/trunk/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/schedule.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/schedule.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -92,13 +92,18 @@
         return davxml.ResourceType.scheduleInbox
 
     def defaultAccessControlList(self):
+        
+        privs = (
+            davxml.Privilege(caldavxml.ScheduleDeliver()),
+        )
+        if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
+            privs += (davxml.Privilege(caldavxml.Schedule()),)
+
         return davxml.ACL(
-            # CalDAV:schedule for any authenticated user
+            # CalDAV:schedule-deliver for any authenticated user
             davxml.ACE(
                 davxml.Principal(davxml.Authenticated()),
-                davxml.Grant(
-                    davxml.Privilege(caldavxml.Schedule()),
-                ),
+                davxml.Grant(*privs),
             ),
         )
 
@@ -195,11 +200,17 @@
         if config.EnableProxyPrincipals:
             myPrincipal = self.parent.principalForRecord()
     
+            privs = (
+                davxml.Privilege(caldavxml.ScheduleSend()),
+            )
+            if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
+                privs += (davxml.Privilege(caldavxml.Schedule()),)
+    
             return davxml.ACL(
                 # CalDAV:schedule for associated write proxies
                 davxml.ACE(
                     davxml.Principal(davxml.HRef(joinURL(myPrincipal.principalURL(), "calendar-proxy-write"))),
-                    davxml.Grant(davxml.Privilege(caldavxml.Schedule()),),
+                    davxml.Grant(*privs),
                     davxml.Protected(),
                 ),
             )
@@ -220,7 +231,7 @@
         issues which the other approach would have with large numbers of recipients.
         """
         # Check authentication and access controls
-        yield self.authorize(request, (caldavxml.Schedule(),))
+        yield self.authorize(request, (caldavxml.ScheduleSend(),))
 
         # This is a local CALDAV scheduling operation.
         scheduler = CalDAVScheduler(request, self)
@@ -247,14 +258,18 @@
         self.parent = parent
 
     def defaultAccessControlList(self):
+        privs = (
+            davxml.Privilege(davxml.Read()),
+            davxml.Privilege(caldavxml.ScheduleDeliver()),
+        )
+        if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
+            privs += (davxml.Privilege(caldavxml.Schedule()),)
+
         return davxml.ACL(
-            # DAV:Read, CalDAV:schedule for all principals (includes anonymous)
+            # DAV:Read, CalDAV:schedule-deliver for all principals (includes anonymous)
             davxml.ACE(
                 davxml.Principal(davxml.All()),
-                davxml.Grant(
-                    davxml.Privilege(davxml.Read()),
-                    davxml.Privilege(caldavxml.Schedule()),
-                ),
+                davxml.Grant(*privs),
                 davxml.Protected(),
             ),
         )
@@ -292,7 +307,7 @@
         """
 
         # Check authentication and access controls
-        yield self.authorize(request, (caldavxml.Schedule(),))
+        yield self.authorize(request, (caldavxml.ScheduleDeliver(),))
 
         # This is a server-to-server scheduling operation.
         scheduler = IScheduleScheduler(request, self)

Modified: CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -101,7 +101,7 @@
             #
             if isinstance(self.scheduler.organizer, LocalCalendarUser):
                 try:
-                    yield recipient.inbox.checkPrivileges(self.scheduler.request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef(self.scheduler.organizer.principal.principalURL())))
+                    yield recipient.inbox.checkPrivileges(self.scheduler.request, (caldavxml.ScheduleDeliver(),), principal=davxml.Principal(davxml.HRef(self.scheduler.organizer.principal.principalURL())))
                 except AccessDeniedError:
                     log.err("Could not access Inbox for recipient: %s" % (recipient.cuaddr,))
                     err = HTTPError(ErrorResponse(responsecode.NOT_FOUND, (caldav_namespace, "recipient-permissions")))

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -243,7 +243,7 @@
         # Find outbox
         outboxURL = principal.scheduleOutboxURL()
         outbox = (yield self.request.locateResource(outboxURL))
-        yield outbox.authorize(self.request, (caldavxml.Schedule(),))
+        yield outbox.authorize(self.request, (caldavxml.ScheduleSend(),))
 
     @inlineCallbacks
     def doImplicitOrganizer(self):

Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -67,7 +67,7 @@
         if method:
             calendar.removeProperty(method)
         
-        if config.Scheduling["CalDAV"]["OldDraftCompatability"] and recipient and not autoprocessing:
+        if config.Scheduling["CalDAV"]["OldDraftCompatibility"] and recipient and not autoprocessing:
             iTipProcessing.fixForiCal3(calendar.subcomponents(), recipient)
 
         return calendar
@@ -135,7 +135,7 @@
                     component = component.duplicate()
                     iTipProcessing.transferItems(calendar, master_valarms, private_comments, component, remove_matched=True)
                     calendar.addComponent(component)
-                    if config.Scheduling["CalDAV"]["OldDraftCompatability"] and recipient and not autoprocessing:
+                    if config.Scheduling["CalDAV"]["OldDraftCompatibility"] and recipient and not autoprocessing:
                         iTipProcessing.fixForiCal3((component,), recipient)
 
             # Write back the modified object

Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -533,7 +533,7 @@
             
             # Anything else is not allowed. However, for compatIbility we will optionally 
             # return a success response for all attendees.
-            if config.Scheduling["CalDAV"]["OldDraftCompatability"]:
+            if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
                 self.fakeTheResult = True
             else:
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Invalid iTIP message for implicit scheduling"))

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/static.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -754,14 +754,6 @@
             (caldav_namespace, "calendar-collection-location-ok")
         )
 
-
-    ##
-    # ACL
-    ##
-
-    def supportedPrivileges(self, request):
-        return succeed(schedulePrivilegeSet)
-
 class ScheduleInboxFile (ScheduleInboxResource, ScheduleFile):
     """
     Calendar scheduling inbox collection resource.
@@ -784,6 +776,14 @@
     def __repr__(self):
         return "<%s (calendar inbox collection): %s>" % (self.__class__.__name__, self.fp.path)
 
+
+    ##
+    # ACL
+    ##
+
+    def supportedPrivileges(self, request):
+        return succeed(deliverSchedulePrivilegeSet)
+
 class ScheduleOutboxFile (ScheduleOutboxResource, ScheduleFile):
     """
     Calendar scheduling outbox collection resource.
@@ -802,6 +802,14 @@
     def __repr__(self):
         return "<%s (calendar outbox collection): %s>" % (self.__class__.__name__, self.fp.path)
 
+
+    ##
+    # ACL
+    ##
+
+    def supportedPrivileges(self, request):
+        return succeed(sendSchedulePrivilegeSet)
+
 class IScheduleInboxFile (IScheduleInboxResource, CalDAVFile):
     """
     Server-to-server scheduling inbox resource.
@@ -837,6 +845,13 @@
             (caldav_namespace, "calendar-collection-location-ok")
         )
 
+    ##
+    # ACL
+    ##
+
+    def supportedPrivileges(self, request):
+        return succeed(deliverSchedulePrivilegeSet)
+
 class IMIPInboxFile (IMIPInboxResource, CalDAVFile):
     """
     Mail gateway IMIP-delivery resource.
@@ -872,6 +887,13 @@
             (caldav_namespace, "calendar-collection-location-ok")
         )
 
+    ##
+    # ACL
+    ##
+
+    def supportedPrivileges(self, request):
+        return succeed(deliverSchedulePrivilegeSet)
+
 class FreeBusyURLFile (AutoProvisioningFileMixIn, FreeBusyURLResource, CalDAVFile):
     """
     Free-busy URL resource.
@@ -909,7 +931,7 @@
     ##
 
     def supportedPrivileges(self, request):
-        return succeed(schedulePrivilegeSet)
+        return succeed(deliverSchedulePrivilegeSet)
 
 class DropBoxHomeFile (AutoProvisioningFileMixIn, DropBoxHomeResource, CalDAVFile):
     def __init__(self, path, parent):
@@ -994,7 +1016,7 @@
     # Otherwise, there is no child
     return (None, ())
 
-def _schedulePrivilegeSet():
+def _schedulePrivilegeSet(deliver):
     edited = False
 
     top_supported_privileges = []
@@ -1006,10 +1028,17 @@
             all_supported_privileges = list(supported_privilege.childrenOfType(davxml.SupportedPrivilege))
             all_supported_privileges.append(
                 davxml.SupportedPrivilege(
-                    davxml.Privilege(caldavxml.Schedule()),
+                    davxml.Privilege(caldavxml.ScheduleDeliver() if deliver else caldavxml.ScheduleSend()),
                     davxml.Description("schedule privileges for current principal", **{"xml:lang": "en"}),
                 ),
             )
+            if config.Scheduling["CalDAV"]["OldDraftCompatibility"]:
+                all_supported_privileges.append(
+                    davxml.SupportedPrivilege(
+                        davxml.Privilege(caldavxml.Schedule()),
+                        davxml.Description("old-style schedule privileges for current principal", **{"xml:lang": "en"}),
+                    ),
+                )
             top_supported_privileges.append(
                 davxml.SupportedPrivilege(all_privilege, all_description, *all_supported_privileges)
             )
@@ -1021,7 +1050,8 @@
 
     return davxml.SupportedPrivilegeSet(*top_supported_privileges)
 
-schedulePrivilegeSet = _schedulePrivilegeSet()
+deliverSchedulePrivilegeSet = _schedulePrivilegeSet(True)
+sendSchedulePrivilegeSet = _schedulePrivilegeSet(False)
 
 def _calendarPrivilegeSet ():
     edited = False

Modified: CalendarServer/trunk/twistedcaldav/test/test_options.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_options.py	2008-10-23 03:05:36 UTC (rev 3215)
+++ CalendarServer/trunk/twistedcaldav/test/test_options.py	2008-10-23 19:54:24 UTC (rev 3216)
@@ -40,7 +40,7 @@
             self.assertIn("calendar-auto-schedule", dav, "no DAV calendar-auto-schedule header")
             self.assertIn("calendar-availability", dav, "no DAV calendar-availability header")
 
-        config.Scheduling["CalDAV"]["OldDraftCompatability"] = True
+        config.Scheduling["CalDAV"]["OldDraftCompatibility"] = True
         request = SimpleRequest(self.site, "OPTIONS", "/")
 
         return self.send(request, do_test)
@@ -60,7 +60,7 @@
             self.assertIn("calendar-auto-schedule", dav, "no DAV calendar-auto-schedule header")
             self.assertIn("calendar-availability", dav, "no DAV calendar-availability header")
 
-        config.Scheduling["CalDAV"]["OldDraftCompatability"] = False
+        config.Scheduling["CalDAV"]["OldDraftCompatibility"] = False
         request = SimpleRequest(self.site, "OPTIONS", "/")
 
         return self.send(request, do_test)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081023/7c39d2ba/attachment-0001.html>


More information about the calendarserver-changes mailing list