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

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 13 08:09:13 PDT 2012


Revision: 9445
          http://trac.macosforge.org/projects/calendarserver/changeset/9445
Author:   cdaboo at apple.com
Date:     2012-07-13 08:09:13 -0700 (Fri, 13 Jul 2012)
Log Message:
-----------
Rich free busy now available for rooms and resources.

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

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2012-07-13 15:03:19 UTC (rev 9444)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2012-07-13 15:09:13 UTC (rev 9445)
@@ -492,15 +492,31 @@
         tz = None
 
     # Look for possible extended free busy information
+    rich_options = {
+        "organizer": False,
+        "delegate": False,
+        "resource": False,
+    }
     do_event_details = False
     if event_details is not None and organizer_principal is not None and userPrincipal is not None:
          
-        # Check of organizer is a delegate of attendee, or organizer is attendee
+        # Check if organizer is attendee
         if organizer_principal == userPrincipal:
             do_event_details = True
-        else:
-            do_event_details = (yield organizer_principal.isProxyFor(userPrincipal))
+            rich_options["organizer"] = True
 
+        # Check if organizer is a delegate of attendee
+        proxy = (yield organizer_principal.isProxyFor(userPrincipal))
+        if config.Scheduling.Options.DelegeteRichFreeBusy and proxy:
+            do_event_details = True
+            rich_options["delegate"] = True
+
+        # Check if attendee is room or resource
+        if config.Scheduling.Options.RoomResourceRichFreeBusy and userPrincipal.getCUType() in ("RESOURCE", "ROOM",):
+            do_event_details = True
+            rich_options["resource"] = True
+
+
     # Try cache
     resources = (yield FBCacheEntry.getCacheEntry(calresource, useruid, timerange)) if config.EnableFreeBusyCache else None
 
@@ -625,7 +641,7 @@
                 if do_event_details:
                     child = (yield request.locateChildResource(calresource, name))
                     calendar = (yield child.iCalendarForUser(request))
-                    _addEventDetails(calendar, event_details, timerange, tzinfo)
+                    _addEventDetails(calendar, event_details, rich_options, timerange, tzinfo)
 
         else:
             child = (yield request.locateChildResource(calresource, name))
@@ -672,11 +688,11 @@
                 if calendar.mainType() == "VEVENT" and do_event_details:
                     child = (yield request.locateChildResource(calresource, name))
                     calendar = (yield child.iCalendarForUser(request))
-                    _addEventDetails(calendar, event_details, timerange, tzinfo)
+                    _addEventDetails(calendar, event_details, rich_options, timerange, tzinfo)
     
     returnValue(matchtotal)
 
-def _addEventDetails(calendar, event_details, timerange, tzinfo):
+def _addEventDetails(calendar, event_details, rich_options, timerange, tzinfo):
     """
     Expand events within the specified time range and limit the set of properties to those allowed for
     delegate extended free busy.
@@ -694,17 +710,24 @@
     # First expand the component
     expanded = calendar.expand(timerange.start, timerange.end, timezone=tzinfo)
 
-    # Remove all but essential properties
-    expanded.filterProperties(keep=(
+    keep_props = (
         "UID",
         "RECURRENCE-ID",
         "DTSTAMP",
         "DTSTART",
         "DTEND",
         "DURATION",
-        "SUMMARY",
-    ))
+    )
 
+    if rich_options["organizer"] or rich_options["delegate"]:
+        keep_props += ("SUMMARY",)
+
+    if rich_options["organizer"] or rich_options["resource"]:
+        keep_props += ("ORGANIZER",)
+
+    # Remove all but essential properties
+    expanded.filterProperties(keep=keep_props)
+
     # Need to remove all child components of VEVENT
     for subcomponent in expanded.subcomponents():
         if subcomponent.name() == "VEVENT":

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2012-07-13 15:03:19 UTC (rev 9444)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2012-07-13 15:09:13 UTC (rev 9445)
@@ -654,6 +654,9 @@
             "V1Compatibility"                     : False,  # Allow /path-based CUAs in scheduling replies
             "PrincipalHostAliases"                : [],     # Hostnames matched in http(s) CUAs
             
+            "DelegeteRichFreeBusy"                : True,   # Delegates can get extra info in a freebusy request
+            "RoomResourceRichFreeBusy"            : True,   # Any user can get extra info for rooms/resources in a freebusy request 
+
             "AutoSchedule" : {
                 "Enabled"                         : True,   # Auto-scheduling will never occur if set to False
                 "Always"                          : False,  # Override augments setting and always auto-schedule
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120713/275b95e7/attachment.html>


More information about the calendarserver-changes mailing list