[CalendarServer-changes] [14337] CalendarServer/trunk/txdav/caldav/datastore/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 23 15:46:44 PST 2015


Revision: 14337
          http://trac.calendarserver.org//changeset/14337
Author:   cdaboo at apple.com
Date:     2015-01-23 15:46:44 -0800 (Fri, 23 Jan 2015)
Log Message:
-----------
Fix issue where invalid or iMIP attendees would cause a 500 on certain kinds of PUTs.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py	2015-01-23 20:21:47 UTC (rev 14336)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py	2015-01-23 23:46:44 UTC (rev 14337)
@@ -1165,8 +1165,7 @@
                 cuaddr = attendee.value()
                 if cuaddr not in coerced:
                     attendeeAddress = (yield calendarUserFromCalendarUserAddress(cuaddr, self.txn))
-                    local_attendee = type(attendeeAddress) in (LocalCalendarUser, OtherServerCalendarUser,)
-                    coerced[cuaddr] = local_attendee
+                    coerced[cuaddr] = attendeeAddress.hosted()
                 if coerced[cuaddr]:
                     attendee.removeParameter("SCHEDULE-AGENT")
 
@@ -1614,7 +1613,7 @@
                     found_old = False
                     for attendee in oldattendess:
                         attendeeAddress = (yield calendarUserFromCalendarUserAddress(attendee, self.txn))
-                        if attendeeAddress and attendeeAddress.record.uid == self.calendar_home.uid():
+                        if attendeeAddress.hosted() and attendeeAddress.record.uid == self.calendar_home.uid():
                             found_old = True
                             break
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py	2015-01-23 20:21:47 UTC (rev 14336)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py	2015-01-23 23:46:44 UTC (rev 14337)
@@ -1648,7 +1648,72 @@
         self.assertTrue(list2[1].startswith(hashlib.md5("12345-67890").hexdigest()))
 
 
+    @inlineCallbacks
+    def test_doImplicitScheduling_MissingAttendeeWithInvalidUser(self):
+        """
+        Test that doImplicitMissingAttendee works when the event contains an
+        invalid attendee.
+        """
 
+        data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+DTSTART:20140302T190000Z
+DURATION:PT1H
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:foo at bar.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+END:VCALENDAR
+"""
+        yield self._createCalendarObject(data1, "user02", "test.ics")
+        list2 = (yield self._listCalendarObjects("user02"))
+        self.assertEqual(len(list2), 1)
+
+        yield self._setCalendarData(data1, "user02", "test.ics")
+        list2 = (yield self._listCalendarObjects("user02"))
+        self.assertEqual(len(list2), 1)
+
+
+    @inlineCallbacks
+    def test_doImplicitScheduling_MissingAttendeeWithiMIP(self):
+        """
+        Test that doImplicitMissingAttendee works when iMIP is enabled and the event
+        contains an iMIP attendee.
+        """
+
+        data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20080601T120000Z
+DTSTART:20140302T190000Z
+DURATION:PT1H
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:foo at bar.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+END:VCALENDAR
+"""
+        self.patch(config.Scheduling.iMIP, "Enabled", True)
+        self.patch(config.Scheduling.iMIP, "AddressPatterns", ["mailto:.*"])
+
+        yield self._createCalendarObject(data1, "user02", "test.ics")
+        list2 = (yield self._listCalendarObjects("user02"))
+        self.assertEqual(len(list2), 1)
+
+        yield self._setCalendarData(data1, "user02", "test.ics")
+        list2 = (yield self._listCalendarObjects("user02"))
+        self.assertEqual(len(list2), 1)
+
+
+
 class ScheduleAgentFixBase(CommonCommonTests, TestCase):
     """
     Test txdav.caldav.datastore.scheduling.implicit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150123/a7924409/attachment-0001.html>


More information about the calendarserver-changes mailing list