[CalendarServer-changes] [3406] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Sun Nov 23 20:25:47 PST 2008


Revision: 3406
          http://trac.macosforge.org/projects/calendarserver/changeset/3406
Author:   cdaboo at apple.com
Date:     2008-11-23 20:25:46 -0800 (Sun, 23 Nov 2008)
Log Message:
-----------
Provide configuration option to control what types of "record" can be an Organizer of an event.

Modified Paths:
--------------
    CalendarServer/trunk/conf/caldavd-test.plist
    CalendarServer/trunk/conf/caldavd.plist
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/directory/principal.py
    CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py

Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist	2008-11-22 03:44:13 UTC (rev 3405)
+++ CalendarServer/trunk/conf/caldavd-test.plist	2008-11-24 04:25:46 UTC (rev 3406)
@@ -546,6 +546,17 @@
         </array>
       </dict>
 
+	  <!-- General options for scheduling -->
+	  <key>Options</key>
+	  <dict>
+        <key>AllowGroupAsOrganizer</key>
+        <true/>
+        <key>AllowLocationAsOrganizer</key>
+        <false/>
+        <key>AllowResourceAsOrganizer</key>
+        <false/>
+       </dict>
+
     </dict>
 
 

Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist	2008-11-22 03:44:13 UTC (rev 3405)
+++ CalendarServer/trunk/conf/caldavd.plist	2008-11-24 04:25:46 UTC (rev 3406)
@@ -419,6 +419,17 @@
         </array>
       </dict>
 
+	  <!-- General options for scheduling -->
+	  <key>Options</key>
+	  <dict>
+        <key>AllowGroupAsOrganizer</key>
+        <true/>
+        <key>AllowLocationAsOrganizer</key>
+        <false/>
+        <key>AllowResourceAsOrganizer</key>
+        <false/>
+       </dict>
+
     </dict>
 
 

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2008-11-22 03:44:13 UTC (rev 3405)
+++ CalendarServer/trunk/twistedcaldav/config.py	2008-11-24 04:25:46 UTC (rev 3406)
@@ -275,6 +275,11 @@
             "InvitationDaysToLive" : 90, # How many days invitations are valid
         },
 
+        "Options" : {
+            "AllowGroupAsOrganizer"      : True,  # Allow groups to be Organizers
+            "AllowLocationAsOrganizer"   : False, # Allow locations to be Organizers
+            "AllowResourceAsOrganizer"   : False, # Allow resources to be Organizers
+        }
     },
 
     "FreeBusyURL": {

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2008-11-22 03:44:13 UTC (rev 3405)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2008-11-24 04:25:46 UTC (rev 3406)
@@ -737,6 +737,18 @@
     def autoSchedule(self):
         return self.record.autoSchedule
 
+    def enabledAsOrganizer(self):
+        if self.record.recordType == DirectoryService.recordType_users:
+            return True
+        elif self.record.recordType == DirectoryService.recordType_groups:
+            return config.Scheduling.Options.AllowGroupAsOrganizer
+        elif self.record.recordType == DirectoryService.recordType_locations:
+            return config.Scheduling.Options.AllowLocationAsOrganizer
+        elif self.record.recordType == DirectoryService.recordType_resources:
+            return config.Scheduling.Options.AllowResourceAsOrganizer
+        else:
+            return False
+
     def proxies(self):
         return self._getRelatives("proxies")
 

Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2008-11-22 03:44:13 UTC (rev 3405)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2008-11-24 04:25:46 UTC (rev 3406)
@@ -447,6 +447,10 @@
             if organizerPrincipal:
                 outboxURL = organizerPrincipal.scheduleOutboxURL()
                 if outboxURL:
+                    if not organizerPrincipal.enabledAsOrganizer():
+                        log.err("ORGANIZER not allowed to be an Organizer: %s" % (self.calendar,))
+                        raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "organizer-allowed")))
+
                     self.organizer = LocalCalendarUser(organizer, organizerPrincipal)
                 else:
                     log.err("No outbox for ORGANIZER in calendar data: %s" % (self.calendar,))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081123/ecbbb7f7/attachment.html>


More information about the calendarserver-changes mailing list