[CalendarServer-changes] [3127] CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 7 09:50:12 PDT 2008
Revision: 3127
http://trac.macosforge.org/projects/calendarserver/changeset/3127
Author: cdaboo at apple.com
Date: 2008-10-07 09:50:11 -0700 (Tue, 07 Oct 2008)
Log Message:
-----------
Allow attendees to change their partstat when the Organizer is not on the server.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2008-10-06 23:58:04 UTC (rev 3126)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2008-10-07 16:50:11 UTC (rev 3127)
@@ -26,6 +26,9 @@
from twistedcaldav.scheduling.icaldiff import iCalDiff
from twistedcaldav import caldavxml
from twisted.web2.dav import davxml
+from twistedcaldav.scheduling import addressmapping
+from twistedcaldav.scheduling.cuaddress import InvalidCalendarUser,\
+ LocalCalendarUser
__all__ = [
"ImplicitScheduler",
@@ -81,7 +84,8 @@
yield self.extractCalendarData()
# Determine what type of scheduling this is: Organizer triggered or Attendee triggered
- if self.isOrganizerScheduling():
+ organizer_scheduling = (yield self.isOrganizerScheduling())
+ if organizer_scheduling:
yield self.doImplicitOrganizer()
elif self.isAttendeeScheduling():
yield self.doImplicitAttendee()
@@ -114,7 +118,8 @@
# Get some useful information from the calendar
yield self.extractCalendarData()
self.organizerPrincipal = self.resource.principalForCalendarUserAddress(self.organizer)
-
+ self.organizerAddress = (yield addressmapping.mapper.getCalendarUser(self.organizer, self.organizerPrincipal))
+
# Originator is the organizer in this case
self.originatorPrincipal = self.organizerPrincipal
self.originator = self.organizer
@@ -164,6 +169,7 @@
# Some other useful things
self.uid = self.calendar.resourceUID()
+ @inlineCallbacks
def isOrganizerScheduling(self):
"""
Test whether this is a scheduling operation by an organizer
@@ -171,18 +177,19 @@
# First must have organizer property
if not self.organizer:
- return False
+ returnValue(False)
# Organizer must map to a valid principal
self.organizerPrincipal = self.resource.principalForCalendarUserAddress(self.organizer)
+ self.organizerAddress = (yield addressmapping.mapper.getCalendarUser(self.organizer, self.organizerPrincipal))
if not self.organizerPrincipal:
- return False
+ returnValue(False)
# Organizer must be the owner of the calendar resource
if str(self.calendar_owner) != self.organizerPrincipal.principalURL():
- return False
+ returnValue(False)
- return True
+ returnValue(True)
def isAttendeeScheduling(self):
@@ -444,13 +451,24 @@
else:
# Get the ORGANIZER's current copy of the calendar object
yield self.getOrganizersCopy()
- assert self.organizer_calendar, "Must have the organizer's copy of an invite"
+ if self.organizer_calendar:
- # Determine whether the current change is allowed
- if self.isAttendeeChangeInsignificant():
- log.debug("Implicit - attendee '%s' is updating UID: '%s' but change is not significant" % (self.attendee, self.uid))
- returnValue(None)
-
+ # Determine whether the current change is allowed
+ if self.isAttendeeChangeInsignificant():
+ log.debug("Implicit - attendee '%s' is updating UID: '%s' but change is not significant" % (self.attendee, self.uid))
+ returnValue(None)
+ elif isinstance(self.organizerAddress, LocalCalendarUser):
+ assert self.organizer_calendar, "Must have the organizer's copy of an invite"
+ elif isinstance(self.organizerAddress, InvalidCalendarUser):
+ log.debug("Attendee '%s' is not allowed to update UID: '%s' with invalid organizer '%s'" % (self.attendee, self.uid, self.organizer))
+ raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "valid-attendee-change")))
+ else:
+ # We have a remote Organizer of some kind. For now we will allow the Attendee
+ # to make any change they like as we cannot verify what is reasonable. In reality
+ # we ought to be comparing the Attendee changes against the attendee's own copy
+ # and restrict changes based on that when the organizer's copy is not available.
+ pass
+
log.debug("Implicit - attendee '%s' is updating UID: '%s'" % (self.attendee, self.uid))
yield self.scheduleWithOrganizer()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081007/9437f0f0/attachment.html
More information about the calendarserver-changes
mailing list