[CalendarServer-changes] [10168] CalendarServer/trunk/twistedcaldav/scheduling/implicit.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 14 09:16:56 PST 2012


Revision: 10168
          http://trac.calendarserver.org//changeset/10168
Author:   cdaboo at apple.com
Date:     2012-12-14 09:16:56 -0800 (Fri, 14 Dec 2012)
Log Message:
-----------
Coerce SCHEDULE-AGENT=CLIENT to SERVER for locally hosted attendees.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2012-12-14 17:14:40 UTC (rev 10167)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2012-12-14 17:16:56 UTC (rev 10168)
@@ -437,6 +437,9 @@
                 "Only one organizer allowed in scheduling object resource",
             ))
 
+        # Coerce any local with SCHEDULE-AGENT=CLIENT
+        yield self.coerceAttendeeScheduleAgent()
+
         # Get the ATTENDEEs
         self.attendeesByInstance = self.calendar.getAttendeesByInstance(True, onlyScheduleAgentServer=True)
         self.instances = set(self.calendar.getComponentInstances())
@@ -875,6 +878,26 @@
 
 
     @inlineCallbacks
+    def coerceAttendeeScheduleAgent(self):
+        """
+        Do not allow SCHEDULE-AGENT=CLIENT/NONE for attendees hosted by this server. Coerce to
+        SCHEDULE-AGENT=SERVER.
+        """
+
+        coerced = {}
+        for attendee in self.calendar.getAllAttendeeProperties():
+            if attendee.parameterValue("SCHEDULE-AGENT", "SERVER").upper() == "CLIENT":
+                cuaddr = attendee.value()
+                if cuaddr not in coerced:
+                    attendeePrincipal = self.resource.principalForCalendarUserAddress(cuaddr)
+                    attendeeAddress = (yield addressmapping.mapper.getCalendarUser(cuaddr, attendeePrincipal))
+                    local_attendee = type(attendeeAddress) in (LocalCalendarUser, PartitionedCalendarUser, OtherServerCalendarUser,)
+                    coerced[cuaddr] = local_attendee
+                if coerced[cuaddr]:
+                    attendee.removeParameter("SCHEDULE-AGENT")
+
+
+    @inlineCallbacks
     def scheduleWithAttendees(self):
 
         # First process cancelled attendees
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121214/c8184ad9/attachment.html>


More information about the calendarserver-changes mailing list