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

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 5 11:06:06 PST 2007


Revision: 1310
          http://trac.macosforge.org/projects/calendarserver/changeset/1310
Author:   cdaboo at apple.com
Date:     2007-03-05 11:06:06 -0800 (Mon, 05 Mar 2007)

Log Message:
-----------
Mask UID support - mask out event match supplied UID proeprty from busy time.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/ical.py
    CalendarServer/trunk/twistedcaldav/method/report_common.py
    CalendarServer/trunk/twistedcaldav/schedule.py

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2007-03-05 19:04:38 UTC (rev 1309)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2007-03-05 19:06:06 UTC (rev 1310)
@@ -974,6 +974,27 @@
 
         return None
 
+    def getMaskUID(self):
+        """
+        Get the X-CALENDARSEREVR-MASK-UID value. Works on either a VCALENDAR or on a component.
+        
+        @return: the string value of the X-CALENDARSEREVR-MASK-UID property, or None
+        """
+        
+        # Extract appropriate sub-component if this is a VCALENDAR
+        if self.name() == "VCALENDAR":
+            for component in self.subcomponents():
+                if component.name() != "VTIMEZONE":
+                    return component.getMaskUID()
+        else:
+            try:
+                # Find the primary subcomponent
+                return self.propertyValue("X-CALENDARSERVER-MASK-UID")
+            except:
+                pass
+
+        return None
+
 ##
 # Dates and date-times
 ##

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2007-03-05 19:04:38 UTC (rev 1309)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2007-03-05 19:06:06 UTC (rev 1310)
@@ -259,7 +259,7 @@
 
 _namedPropertiesForResource = deferredGenerator(_namedPropertiesForResource)
     
-def generateFreeBusyInfo(request, calresource, fbinfo, timerange, matchtotal, excludeuid=None):
+def generateFreeBusyInfo(request, calresource, fbinfo, timerange, matchtotal, excludeuid=None, organizer=None):
     """
     Run a free busy report on the specified calendar collection
     accumulating the free busy info for later processing.
@@ -268,8 +268,10 @@
     @param fbinfo:      the array of busy periods to update.
     @param timerange:   the L{TimeRange} for the query.
     @param matchtotal:  the running total for the number of matches.
-    @param excludeuid:  the C{str} containing a UID value to exclude any components with that
+    @param excludeuid:  a C{str} containing a UID value to exclude any components with that
         UID from contributing to free-busy.
+    @param organizer:   a C{str} containing the value of the ORGANIZER proeprty in the VFREEBUSY request.
+        This is used in conjunction with the UID value to process exclusions.
     """
     
     # First check the privilege on this collection
@@ -327,10 +329,6 @@
 
     for name, uid, type in calresource.index().search(filter): #@UnusedVariable
         
-        # Ignore ones of this UID
-        if excludeuid and (excludeuid == uid):
-            continue
-
         # Check privileges - must have at least CalDAV:read-free-busy
         child = waitForDeferred(request.locateChildResource(calresource, name))
         yield child
@@ -346,6 +344,12 @@
         calendar = calresource.iCalendar(name)
         assert calendar is not None, "Calendar %s is missing from calendar collection %r" % (name, calresource)
         
+        # Ignore ones of this UID
+        if excludeuid:
+            # Check that ORGANIZER's match (security requirement) and UIDs match
+            if (excludeuid == uid) and ((organizer is None) or (organizer == calendar.getOrganizer())):
+                continue
+
         if filter.match(calendar):
             # Check size of results is within limit
             matchtotal += 1

Modified: CalendarServer/trunk/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/schedule.py	2007-03-05 19:04:38 UTC (rev 1309)
+++ CalendarServer/trunk/twistedcaldav/schedule.py	2007-03-05 19:06:06 UTC (rev 1310)
@@ -266,6 +266,9 @@
             timerange.start = dtstart
             timerange.end = dtend
 
+            # Look for maksed UID
+            excludeuid = calendar.getMaskUID()
+
             # Do free busy operation
             freebusy = True
         else:
@@ -275,7 +278,7 @@
         # Prepare for multiple responses
         responses = ScheduleResponseQueue("POST", responsecode.OK)
     
-        # Extract the ORGANIZER property and UID value from the calendar data  for use later
+        # Extract the ORGANIZER property and UID value from the calendar data for use later
         organizerProp = calendar.getOrganizerProperty()
         uid = calendar.resourceUID()
 
@@ -347,7 +350,14 @@
                                 # properly manage the free busy set that should not prevent us from working.
                                 continue
                          
-                            matchtotal = waitForDeferred(report_common.generateFreeBusyInfo(request, cal, fbinfo, timerange, matchtotal))
+                            matchtotal = waitForDeferred(report_common.generateFreeBusyInfo(
+                                request,
+                                cal,
+                                fbinfo,
+                                timerange,
+                                matchtotal,
+                                excludeuid=excludeuid,
+                                organizer=organizer))
                             yield matchtotal
                             matchtotal = matchtotal.getResult()
                     

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070305/cba62349/attachment.html


More information about the calendarserver-changes mailing list