[CalendarServer-changes] [3886] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 18 14:48:42 PDT 2009
Revision: 3886
http://trac.macosforge.org/projects/calendarserver/changeset/3886
Author: cdaboo at apple.com
Date: 2009-03-18 14:48:41 -0700 (Wed, 18 Mar 2009)
Log Message:
-----------
Add limit for maximum number of attendees per event - default to 100.
Modified Paths:
--------------
CalendarServer/trunk/conf/caldavd-test.plist
CalendarServer/trunk/conf/caldavd.plist
CalendarServer/trunk/run
CalendarServer/trunk/twistedcaldav/caldavxml.py
CalendarServer/trunk/twistedcaldav/config.py
CalendarServer/trunk/twistedcaldav/method/put_common.py
CalendarServer/trunk/twistedcaldav/resource.py
Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/conf/caldavd-test.plist 2009-03-18 21:48:41 UTC (rev 3886)
@@ -101,7 +101,12 @@
<key>MaximumAttachmentSize</key>
<integer>1048576</integer><!-- 1Mb -->
+ <!-- Maximum number of unique attendees per entire event -->
+ <!-- 0 for no limit -->
+ <key>MaxAttendeesPerInstance</key>
+ <integer>100</integer>
+
<!--
Directory service
Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/conf/caldavd.plist 2009-03-18 21:48:41 UTC (rev 3886)
@@ -104,7 +104,12 @@
<key>MaximumAttachmentSize</key>
<integer>1048576</integer><!-- 1Mb -->
+ <!-- Maximum number of unique attendees per entire event -->
+ <!-- 0 for no limit -->
+ <key>MaxAttendeesPerInstance</key>
+ <integer>100</integer>
+
<!--
Directory service
Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/run 2009-03-18 21:48:41 UTC (rev 3886)
@@ -711,7 +711,7 @@
caldavtester="${top}/CalDAVTester";
-svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3875;
+svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3885;
#
# PyFlakes
Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py 2009-03-18 21:48:41 UTC (rev 3886)
@@ -287,6 +287,15 @@
hidden = True
protected = True
+class MaxAttendeesPerInstance (CalDAVTextElement):
+ """
+ Specifies restrictions on a calendar collection.
+ (CalDAV-access-15, section 5.2.9)
+ """
+ name = "max-attendees-per-instance"
+ hidden = True
+ protected = True
+
class Calendar (CalDAVEmptyElement):
"""
Denotes a calendar collection.
Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/twistedcaldav/config.py 2009-03-18 21:48:41 UTC (rev 3886)
@@ -110,11 +110,12 @@
#
# Data store
#
- "DataRoot" : "/Library/CalendarServer/Data",
- "DocumentRoot" : "/Library/CalendarServer/Documents",
- "UserQuota" : 104857600, # User quota (in bytes)
- "MaximumAttachmentSize": 1048576, # Attachment size limit (in bytes)
- "WebCalendarRoot" : "/usr/share/collaboration",
+ "DataRoot" : "/Library/CalendarServer/Data",
+ "DocumentRoot" : "/Library/CalendarServer/Documents",
+ "UserQuota" : 104857600, # User quota (in bytes)
+ "MaximumAttachmentSize" : 1048576, # Attachment size limit (in bytes)
+ "MaxAttendeesPerInstance" : 100, # Maximum number of unique attendees
+ "WebCalendarRoot" : "/usr/share/collaboration",
"Aliases": {},
Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py 2009-03-18 21:48:41 UTC (rev 3886)
@@ -332,6 +332,12 @@
log.err(message)
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "valid-calendar-object-resource")))
+ # Valid attendee list size check
+ result, message = self.validAttendeeListSizeCheck()
+ if not result:
+ log.err(message)
+ raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "max-attendees-per-instance")))
+
# Normalize the calendar user addresses once we know we have valid
# calendar data
self.destination.iCalendarAddressDoNormalization(self.calendar)
@@ -513,6 +519,23 @@
return result, message
+ def validAttendeeListSizeCheck(self):
+ """
+ Make sure that the Attendee list length is within bounds.
+ """
+ result = True
+ message = ""
+ if config.MaxAttendeesPerInstance:
+ uniqueAttendees = set()
+ for attendee in self.calendar.getAllAttendeeProperties():
+ uniqueAttendees.add(attendee.value())
+ attendeeListLength = len(uniqueAttendees)
+ if attendeeListLength > config.MaxAttendeesPerInstance:
+ result = False
+ message = "Attendee list size %d is larger than allowed limit %d" % (attendeeListLength, config.MaxAttendeesPerInstance)
+
+ return result, message
+
def validAccess(self):
"""
Make sure that the X-CALENDARSERVER-ACCESS property is properly dealt with.
Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py 2009-03-18 21:42:16 UTC (rev 3885)
+++ CalendarServer/trunk/twistedcaldav/resource.py 2009-03-18 21:48:41 UTC (rev 3886)
@@ -245,6 +245,13 @@
str(config.MaximumAttachmentSize)
))
+ elif name == "max-attendees-per-instance":
+ # CalDAV-access-15, section 5.2.9
+ if config.MaxAttendeesPerInstance:
+ returnValue(caldavxml.MaxAttendeesPerInstance.fromString(
+ str(config.MaxAttendeesPerInstance)
+ ))
+
elif name == "schedule-calendar-transp":
# For backwards compatibility, if the property does not exist we need to create
# it and default to the old free-busy-set value.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090318/9b0d0d4b/attachment.html>
More information about the calendarserver-changes
mailing list