[CalendarServer-changes] [12878] CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav /datastore/scheduling
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:23:12 PDT 2014
Revision: 12878
http://trac.calendarserver.org//changeset/12878
Author: cdaboo at apple.com
Date: 2014-03-12 11:23:12 -0700 (Wed, 12 Mar 2014)
Log Message:
-----------
Make sure to normalize cu-address of organizer before comparisons. Also, always force SCHEDULE-AGENT to server
for hosted organizers.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/implicit.py
CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py
Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/implicit.py 2014-03-12 18:08:45 UTC (rev 12877)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/implicit.py 2014-03-12 18:23:12 UTC (rev 12878)
@@ -528,6 +528,8 @@
self.needs_sequence_change = False
+ self.coerceOrganizerScheduleAgent()
+
# Check for a delete
if self.action == "remove":
@@ -695,8 +697,15 @@
recurrence_reschedule = False
if checkOrganizerValue:
- oldOrganizer = self.oldcalendar.getOrganizer()
- newOrganizer = self.calendar.getOrganizer()
+ def _normalizeCUAddress(addr):
+ if not addr.startswith("urn:uuid"):
+ principal = self.calendar_home.directoryService().recordWithCalendarUserAddress(addr)
+ if principal is not None:
+ addr = principal.canonicalCalendarUserAddress()
+ return addr
+
+ oldOrganizer = _normalizeCUAddress(self.oldcalendar.getOrganizer())
+ newOrganizer = _normalizeCUAddress(self.calendar.getOrganizer())
if oldOrganizer != newOrganizer:
log.error("Cannot change ORGANIZER: UID:%s" % (self.uid,))
raise HTTPError(ErrorResponse(
@@ -892,6 +901,15 @@
return changed
+ def coerceOrganizerScheduleAgent(self):
+ """
+ Do not allow SCHEDULE-AGENT=CLIENT/NONE for organizers hosted by this server when they schedule. Coerce to
+ SCHEDULE-AGENT=SERVER.
+ """
+
+ self.calendar.removePropertyParameters("ORGANIZER", ("SCHEDULE-AGENT",))
+
+
@inlineCallbacks
def coerceAttendeeScheduleAgent(self):
"""
Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py 2014-03-12 18:08:45 UTC (rev 12877)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py 2014-03-12 18:23:12 UTC (rev 12878)
@@ -33,7 +33,8 @@
from txdav.caldav.datastore.scheduling.scheduler import ScheduleResponseQueue
from txdav.caldav.datastore.test.util import buildCalendarStore, \
buildDirectoryRecord
-from txdav.caldav.icalendarstore import AttendeeAllowedError
+from txdav.caldav.icalendarstore import AttendeeAllowedError, \
+ ComponentUpdateState
from txdav.common.datastore.test.util import CommonCommonTests, populateCalendarsFrom
import hashlib
@@ -1250,6 +1251,62 @@
@inlineCallbacks
+ def test_doImplicitScheduling_UpdateMailtoOrganizerEvent(self):
+ """
+ Test that doImplicitScheduling works when the existing calendar data contains a non-normalized
+ organizer calendar user address.
+ """
+
+ data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER;CN="User 01";SCHEDULE-AGENT=NONE:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+ data2 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+DTSTART:20080601T130000Z
+DTEND:20080601T140000Z
+ORGANIZER;CN="User 01";SCHEDULE-AGENT=NONE:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+ yield self._createCalendarObject(data1, "user01", "test.ics")
+
+ cobj = yield self.calendarObjectUnderTest(home="user01", name="test.ics")
+ yield cobj._setComponentInternal(Component.fromString(data1), internal_state=ComponentUpdateState.RAW)
+ yield self.commit()
+
+ cobj = yield self.calendarObjectUnderTest(home="user01", name="test.ics")
+ comp = yield cobj.component()
+ self.assertTrue(comp.getOrganizer().startswith("mailto:"))
+ self.assertFalse(comp.getOrganizerScheduleAgent())
+
+ cobj = yield self.calendarObjectUnderTest(home="user01", name="test.ics")
+ yield cobj.setComponent(Component.fromString(data2))
+ yield self.commit()
+
+ cobj = yield self.calendarObjectUnderTest(home="user01", name="test.ics")
+ comp = yield cobj.component()
+ self.assertTrue(comp.getOrganizer().startswith("urn:uuid:"))
+ self.assertTrue(comp.getOrganizerScheduleAgent())
+
+
+ @inlineCallbacks
def test_doImplicitScheduling_AttendeeEventNoOrganizerEvent(self):
"""
Test that doImplicitScheduling handles an attendee reply with no organizer event.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/b4263bfb/attachment-0001.html>
More information about the calendarserver-changes
mailing list