<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14836] CalendarServer/trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14836">14836</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-05-27 11:25:43 -0700 (Wed, 27 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Don't process attendee replies for schedule-agent=client/none events or ones not listing the attendee.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcalendarservertoolsimporterpy">CalendarServer/trunk/calendarserver/tools/importer.py</a></li>
<li><a href="#CalendarServertrunkrequirementsdevtxt">CalendarServer/trunk/requirements-dev.txt</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingimplicitpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingitippy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingtesttest_implicitpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcalendarservertoolsimporterpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/calendarserver/tools/importer.py (14835 => 14836)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/calendarserver/tools/importer.py        2015-05-27 18:24:04 UTC (rev 14835)
+++ CalendarServer/trunk/calendarserver/tools/importer.py        2015-05-27 18:25:43 UTC (rev 14836)
</span><span class="lines">@@ -278,14 +278,15 @@
</span><span class="cx"> organizerCUA = organizerRecord.canonicalCalendarUserAddress()
</span><span class="cx"> processor = ImplicitProcessor()
</span><span class="cx"> newComponent = iTipGenerator.generateAttendeeReply(groupedComponent, attendeeCUA, method="X-RESTORE")
</span><del>- txn = store.newTransaction()
- yield processor.doImplicitProcessing(
- txn,
- newComponent,
- LocalCalendarUser(attendeeCUA, ownerRecord),
- LocalCalendarUser(organizerCUA, organizerRecord)
- )
- yield txn.commit()
</del><ins>+ if newComponent is not None:
+ txn = store.newTransaction()
+ yield processor.doImplicitProcessing(
+ txn,
+ newComponent,
+ LocalCalendarUser(attendeeCUA, ownerRecord),
+ LocalCalendarUser(organizerCUA, organizerRecord)
+ )
+ yield txn.commit()
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunkrequirementsdevtxt"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/requirements-dev.txt (14835 => 14836)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/requirements-dev.txt        2015-05-27 18:24:04 UTC (rev 14835)
+++ CalendarServer/trunk/requirements-dev.txt        2015-05-27 18:25:43 UTC (rev 14836)
</span><span class="lines">@@ -8,4 +8,4 @@
</span><span class="cx"> q
</span><span class="cx"> tl.eggdeps
</span><span class="cx"> --editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@14811#egg=CalDAVClientLibrary
</span><del>---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@14831#egg=CalDAVTester
</del><ins>+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@14835#egg=CalDAVTester
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingimplicitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py (14835 => 14836)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py        2015-05-27 18:24:04 UTC (rev 14835)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py        2015-05-27 18:25:43 UTC (rev 14836)
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx"> from twext.python.log import Logger
</span><span class="cx"> from txweb2.dav.http import ErrorResponse
</span><span class="cx">
</span><del>-from twisted.internet.defer import inlineCallbacks, returnValue
</del><ins>+from twisted.internet.defer import inlineCallbacks, returnValue, succeed
</ins><span class="cx"> from txweb2 import responsecode
</span><span class="cx"> from txweb2.http import HTTPError
</span><span class="cx">
</span><span class="lines">@@ -504,7 +504,6 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def sendAttendeeReply(self, txn, resource):
</span><del>-
</del><span class="cx"> self.txn = txn
</span><span class="cx"> self.resource = resource
</span><span class="cx">
</span><span class="lines">@@ -520,14 +519,21 @@
</span><span class="cx"> # Get some useful information from the calendar
</span><span class="cx"> yield self.extractCalendarData()
</span><span class="cx">
</span><ins>+ self.organizerAddress = (yield calendarUserFromCalendarUserAddress(self.organizer, self.txn))
</ins><span class="cx"> self.attendeeAddress = (yield calendarUserFromCalendarUserUID(self.calendar_home.uid(), self.txn))
</span><span class="cx"> self.originator = self.attendee = self.attendeeAddress.record.canonicalCalendarUserAddress()
</span><span class="cx">
</span><del>- result = (yield self.scheduleWithOrganizer())
</del><span class="cx">
</span><del>- returnValue(result)
</del><ins>+ # Check SCHEDULE-AGENT
+ if not self.checkOrganizerScheduleAgent():
+ returnValue(False)
</ins><span class="cx">
</span><ins>+ # result is None if this succeeds, else False
+ result = yield self.scheduleWithOrganizer()
</ins><span class="cx">
</span><ins>+ returnValue(result != False)
+
+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def extractCalendarData(self):
</span><span class="cx">
</span><span class="lines">@@ -1726,6 +1732,10 @@
</span><span class="cx"> self.logItems["itip.reply"] = "reply"
</span><span class="cx">
</span><span class="cx"> itipmsg = iTipGenerator.generateAttendeeReply(self.calendar, self.attendee, changedRids=changedRids)
</span><ins>+ if itipmsg is None:
+ # Log and ignore this situation
+ log.debug("Empty iTIP attendee reply: Attendee '{attendee}', UID: {uid}".format(attendee=self.attendee, uid=self.uid))
+ return succeed(False)
</ins><span class="cx"> if config.Scheduling.Options.WorkQueues.Enabled:
</span><span class="cx"> # Always make it look like scheduling succeeded when queuing
</span><span class="cx"> self.calendar.setParameterToValueForPropertyWithValue(
</span><span class="lines">@@ -1751,6 +1761,10 @@
</span><span class="cx"> self.logItems["itip.reply"] = "cancel"
</span><span class="cx">
</span><span class="cx"> itipmsg = iTipGenerator.generateAttendeeReply(self.calendar, self.attendee, force_decline=True)
</span><ins>+ if itipmsg is None:
+ # Log and ignore this situation
+ log.debug("Empty iTIP attendee reply: Attendee '{attendee}', UID: {uid}".format(attendee=self.attendee, uid=self.uid))
+ return succeed(None)
</ins><span class="cx">
</span><span class="cx"> if config.Scheduling.Options.WorkQueues.Enabled:
</span><span class="cx"> return ScheduleReplyWork.reply(self.txn, self.calendar_home, None, itipmsg, self.attendee)
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingitippy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py (14835 => 14836)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py        2015-05-27 18:24:04 UTC (rev 14835)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py        2015-05-27 18:25:43 UTC (rev 14836)
</span><span class="lines">@@ -1124,9 +1124,12 @@
</span><span class="cx"> if component.name() == "VPOLL":
</span><span class="cx"> iTipGenerator.generateVPOLLReply(component, attendee)
</span><span class="cx">
</span><del>- return itip
</del><ins>+ # After all the processing check that we have a valid component - one with a valid UID
+ uid = itip.resourceUID()
</ins><span class="cx">
</span><ins>+ return itip if uid is not None else None
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> @staticmethod
</span><span class="cx"> def generateVPOLLReply(vpoll, attendee):
</span><span class="cx"> """
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingtesttest_implicitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py (14835 => 14836)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py        2015-05-27 18:24:04 UTC (rev 14835)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py        2015-05-27 18:25:43 UTC (rev 14836)
</span><span class="lines">@@ -1713,7 +1713,99 @@
</span><span class="cx"> self.assertEqual(len(list2), 1)
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @inlineCallbacks
+ def test_sendAttendeeReply_ScheduleAgentNone(self):
+ """
+ Test that sendAttendeeReply does nothing when the Organizer has
+ SCHEDULE-AGENT=NONE.
+ """
</ins><span class="cx">
</span><ins>+ 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;SCHEDULE-AGENT=NONE;CN="User 01":mailto:user01@example.com
+ATTENDEE:mailto:user01@example.com
+ATTENDEE:mailto:user02@example.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+END:VCALENDAR
+"""
+ yield self._createCalendarObject(data1, "user02", "test.ics")
+
+ cobj = yield self.calendarObjectUnderTest(home="user02", name="test.ics",)
+ result = yield ImplicitScheduler().sendAttendeeReply(cobj._txn, cobj)
+ self.assertFalse(result)
+
+
+ @inlineCallbacks
+ def test_sendAttendeeReply_ScheduleAgentClient(self):
+ """
+ Test that sendAttendeeReply does nothing when the Organizer has
+ SCHEDULE-AGENT=CLIENT.
+ """
+
+ 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;SCHEDULE-AGENT=CLIENT;CN="User 01":mailto:user01@example.com
+ATTENDEE:mailto:user01@example.com
+ATTENDEE:mailto:user02@example.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+END:VCALENDAR
+"""
+ yield self._createCalendarObject(data1, "user02", "test.ics")
+
+ cobj = yield self.calendarObjectUnderTest(home="user02", name="test.ics",)
+ result = yield ImplicitScheduler().sendAttendeeReply(cobj._txn, cobj)
+ self.assertFalse(result)
+
+
+ @inlineCallbacks
+ def test_sendAttendeeReply_NoAttendee(self):
+ """
+ Test that sendAttendeeReply does nothing when the Attencdee is not
+ listed in the event. This will not normally ever be possible, but a case
+ like this was seen due to a processing error elsewehere.
+ """
+
+ 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@example.com
+ATTENDEE:mailto:user01@example.com
+ATTENDEE:mailto:user03@example.com
+RRULE:FREQ=DAILY;UNTIL=20140309T075959Z
+END:VEVENT
+END:VCALENDAR
+"""
+ yield self._createCalendarObject(data1, "user02", "test.ics")
+
+ cobj = yield self.calendarObjectUnderTest(home="user02", name="test.ics",)
+
+ # Need to remove SCHEDULE-AGENT=NONE on ORGANIZER as that will have been added during the store operation
+ cal = yield cobj.componentForUser()
+ cal.removePropertyParameters("ORGANIZER", ("SCHEDULE-AGENT", "SCHEDULE-STATUS",))
+ result = yield ImplicitScheduler().sendAttendeeReply(cobj._txn, cobj)
+ self.assertFalse(result)
+
+
+
</ins><span class="cx"> class ScheduleAgentFixBase(CommonCommonTests, TestCase):
</span><span class="cx"> """
</span><span class="cx"> Test txdav.caldav.datastore.scheduling.implicit.
</span></span></pre>
</div>
</div>
</body>
</html>