[CalendarServer-changes] [9702] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 14 11:41:00 PDT 2012
Revision: 9702
http://trac.macosforge.org/projects/calendarserver/changeset/9702
Author: sagen at apple.com
Date: 2012-08-14 11:40:59 -0700 (Tue, 14 Aug 2012)
Log Message:
-----------
Don't return an error if a sharer removes a currently-not-shared-to sharee from an invite. Smile and pretend they've been uninvited.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/sharing.py
CalendarServer/trunk/twistedcaldav/test/test_sharing.py
Modified: CalendarServer/trunk/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sharing.py 2012-08-14 17:36:08 UTC (rev 9701)
+++ CalendarServer/trunk/twistedcaldav/sharing.py 2012-08-14 18:40:59 UTC (rev 9702)
@@ -789,7 +789,9 @@
del setDict[u]
for userid, access in removeDict.iteritems():
result = (yield self.uninviteUserToShare(userid, access, request))
- (okusers if result else badusers).add(userid)
+ # If result is False that means the user being removed was not
+ # actually invited, but let's not return an error in this case.
+ okusers.add(userid)
for userid, (cn, access, summary) in setDict.iteritems():
result = (yield self.inviteUserToShare(userid, cn, access, summary, request))
(okusers if result else badusers).add(userid)
Modified: CalendarServer/trunk/twistedcaldav/test/test_sharing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_sharing.py 2012-08-14 17:36:08 UTC (rev 9701)
+++ CalendarServer/trunk/twistedcaldav/test/test_sharing.py 2012-08-14 18:40:59 UTC (rev 9702)
@@ -460,7 +460,52 @@
),
))
+ @inlineCallbacks
+ def test_POSTremoveNonInvitee(self):
+ """
+ Ensure that removing a sharee that is not currently invited
+ doesn't return an error. The server will just pretend it
+ removed the sharee.
+ """
+ self.resource.upgradeToShare()
+
+ yield self._doPOST("""<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:set>
+ <D:href>mailto:user02 at example.com</D:href>
+ <CS:summary>My Shared Calendar</CS:summary>
+ <CS:read-write/>
+ </CS:set>
+ <CS:set>
+ <D:href>mailto:user03 at example.com</D:href>
+ <CS:summary>My Shared Calendar</CS:summary>
+ <CS:read-write/>
+ </CS:set>
+</CS:share>
+""")
+ yield self._doPOST("""<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:remove>
+ <D:href>mailto:user03 at example.com</D:href>
+ </CS:remove>
+</CS:share>
+""")
+ yield self._doPOST("""<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:remove>
+ <D:href>mailto:user02 at example.com</D:href>
+ </CS:remove>
+ <CS:remove>
+ <D:href>mailto:user03 at example.com</D:href>
+ </CS:remove>
+</CS:share>
+""")
+
+ propInvite = (yield self.resource.readProperty(customxml.Invite, None))
+ self.assertEquals(self._clearUIDElementValue(propInvite), customxml.Invite())
+
+
@inlineCallbacks
def test_POSTaddInvalidInvitee(self):
self.resource.upgradeToShare()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120814/0ab671f1/attachment.html>
More information about the calendarserver-changes
mailing list