[CalendarServer-changes] [8831] CalendarServer/trunk/twistedcaldav/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 9 12:29:56 PST 2012


Revision: 8831
          http://trac.macosforge.org/projects/calendarserver/changeset/8831
Author:   cdaboo at apple.com
Date:     2012-03-09 12:29:56 -0800 (Fri, 09 Mar 2012)
Log Message:
-----------
Allow events previous organized by a calendar user now not enabled as the organizer to still be scheduleable.
Also add more detailed comments on the scheduling behavior.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
    CalendarServer/trunk/twistedcaldav/scheduling/imip.py
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
    CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py
    CalendarServer/trunk/twistedcaldav/scheduling/itip.py
    CalendarServer/trunk/twistedcaldav/scheduling/processing.py
    CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2005-2011 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2012 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -45,7 +45,9 @@
 from twistedcaldav.scheduling.processing import ImplicitProcessor, ImplicitProcessorException
 
 """
-Class that handles delivery of scheduling messages via CalDAV.
+Handles the sending of scheduling messages to the server itself. This will cause
+actual processing of the delivery of the message to the recipient's inbox, via the
+L{ImplicitProcessor} class.
 """
 
 __all__ = [

Modified: CalendarServer/trunk/twistedcaldav/scheduling/imip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/imip.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/imip.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2012 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
 from twistedcaldav.scheduling.itip import iTIPRequestStatus
 
 """
-Class that handles delivery of scheduling messages via iMIP.
+Handles the sending of scheduling messages via iMIP (mail gateway).
 """
 
 __all__ = [

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -88,6 +88,9 @@
             self.calendar = (yield resource.iCalendarForUser(request))
             yield self.checkImplicitState()
         
+        # Once we have collected sufficient information from the calendar data, check validity of organizer and attendees
+        self.checkValidOrganizer()
+
         # Attendees are not allowed to overwrite one type with another
         if (
             not self.internal_request and
@@ -187,6 +190,22 @@
 
         returnValue((self.action != "none", False,))
 
+    def checkValidOrganizer(self):
+        """
+        Make sure the ORGANIZER is allowed to do certain scheduling operations.
+        """
+        
+        # Check to see whether the organizer principal is enabled for scheduling. If not, do not allow them
+        # to create new scheduling resources.
+        if self.action == "create":
+            if self.organizerPrincipal and not self.organizerPrincipal.enabledAsOrganizer():
+                log.err("ORGANIZER not allowed to be an Organizer: %s" % (self.organizer,))
+                raise HTTPError(ErrorResponse(
+                    responsecode.FORBIDDEN,
+                    (caldav_namespace, "organizer-allowed"),
+                    "Organizer cannot schedule",
+                ))
+
     @inlineCallbacks
     def checkSchedulingObjectResource(self, resource):
         

Modified: CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2012 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -48,7 +48,8 @@
 import OpenSSL
 
 """
-Server to server utility functions and client requests.
+Handles the sending of iSchedule scheduling messages. Used for both cross-domain scheduling,
+as well as internal partitioning or podding.
 """
 
 __all__ = [

Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -15,20 +15,17 @@
 ##
 
 """
-iTIP (RFC5546) processing.
+iTIP (RFC5546) scheduling message processing and generation.
+
+
+This is currently used for handling auto-replies to schedule requests arriving
+in an inbox. It is called in a delayed fashion via reactor.callLater.
+
+We assume that all the components/calendars we deal with have been determined
+as being 'valid for CalDAV/iTIP', i.e. they contain UIDs, single component
+types, etc.
 """
 
-#
-# This is currently used for handling auto-replies to schedule requests arriving
-# in an inbox. It is called in a delayed fashion via reactor.callLater.
-#
-# We assume that all the components/calendars we deal with have been determined
-# as being 'valid for CalDAV/iTIP', i.e. they contain UIDs, single component
-# types, etc.
-#
-# The logic for component matching needs a lot more work as it currently does not
-# know how to deal with overridden instances.
-#
 
 from twext.python.log import Logger
 

Modified: CalendarServer/trunk/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -40,6 +40,16 @@
 from pycalendar.datetime import PyCalendarDateTime
 from pycalendar.timezone import PyCalendarTimezone
 
+"""
+CalDAV implicit processing.
+
+This module handles the processing of scheduling messages being delivered to a calendar user's inbox.
+It determines who is scheduling (organizer or attendee) and applies the scheduling message changes
+to the recipient's calendar data as well as depositing the scheduling message in the inbox. For users
+who have an auto-accept option on, it will also handle the automatic response. Also, refreshes of other
+attendees (when one attendee replies) are triggered from here.
+"""
+
 __all__ = [
     "ImplicitProcessor",
     "ImplicitProcessorException",

Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2012-03-08 23:54:10 UTC (rev 8830)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2012-03-09 20:29:56 UTC (rev 8831)
@@ -55,6 +55,62 @@
 
 """
 CalDAV/Server-to-Server scheduling behavior.
+
+This module handles the delivery of scheduling messages to organizer and attendees. The basic idea is to first
+confirm the integrity of the incoming scheduling message, check authorization. Appropriate L{DeliveryService}s
+are then used to deliver the message to attendees or organizer. Delivery responses are processed and returned.
+This takes into account partitioning and podding of users by detecting the appropriate host for a calendar
+user and then dispatching the delivery accordingly.
+
+The L{Scheduler} class defines the basic behavior for processing deliveries. Sub-classes are defined for the
+different ways a deliver can be triggered.
+
+L{CalDAVScheduler} - handles deliveries for scheduling messages originating from inside the CalDAV server
+i.e. user PUTs or POSTs.
+
+L{IScheduleScheduler} - handles deliveries for scheduling messages being POSTed to the iSchedule inbox.
+
+L{IMIPScheduler} - handles deliveries for POSTs on the iMIP inbox (coming from the mail gateway).
+
+L{DirectScheduler} - used when doing some internal processing (e.g., inbox item processing during an
+upgrade.
+
+Here is a typical flow of activity for a iTIP between users on the server:
+
+iTIP PUT request
+\
+ \_L{ImplicitScheduler}           - does CalDAV-schedule logic and sends iTIP message
+   \
+    \_L{CalDAVScheduler}          - receives iTIP message
+      \
+       \_L{ScheduleViaCalDAV}     - handles delivery of iTIP message
+         \
+          \_L{ImplicitProcessor}  - dispatches iTIP message (also auto-accept)
+            \
+             \_L{iTipProcessing}  - processes iTIP message
+             
+Here is a typical flow of activity for a iTIP between an organizer on the server and an iMIP attendee:
+
+iTIP PUT request
+\
+ \_L{ImplicitScheduler}
+   \
+    \_L{CalDAVScheduler}
+      \
+       \_L{ScheduleViaIMip}
+
+Here is a typical flow of activity for a iTIP between an organizer not on the server and attendee on the server:
+
+iTIP POST on /ischedule
+\
+ \_L{IScheduleScheduler}
+   \
+    \_L{ScheduleViaCalDAV}
+      \
+       \_L{ImplicitProcessor}
+         \
+          \_L{iTipProcessing}
+
 """
 
 __all__ = [
@@ -671,7 +727,11 @@
             if organizerPrincipal:
                 outboxURL = organizerPrincipal.scheduleOutboxURL()
                 if outboxURL:
-                    if not organizerPrincipal.enabledAsOrganizer():
+                    
+                    # Only do this check for a freebusy request. A check for an invite needs
+                    # to be handled later when we know whether a new invite is being added
+                    # (which we reject) vs an update to an existing one (which we allow).
+                    if self.checkForFreeBusy() and not organizerPrincipal.enabledAsOrganizer():
                         log.err("ORGANIZER not allowed to be an Organizer: %s" % (self.calendar,))
                         raise HTTPError(ErrorResponse(
                             responsecode.FORBIDDEN,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120309/461db297/attachment-0001.html>


More information about the calendarserver-changes mailing list