[CalendarServer-changes] [9399] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 29 08:11:18 PDT 2012


Revision: 9399
          http://trac.macosforge.org/projects/calendarserver/changeset/9399
Author:   cdaboo at apple.com
Date:     2012-06-29 08:11:18 -0700 (Fri, 29 Jun 2012)
Log Message:
-----------
Sharees can now see who the other invitees are.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/customxml.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/sharing.py

Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py	2012-06-29 15:10:20 UTC (rev 9398)
+++ CalendarServer/trunk/twistedcaldav/customxml.py	2012-06-29 15:11:18 UTC (rev 9399)
@@ -983,7 +983,7 @@
     name = "user"
 
     allowed_children = {
-        (calendarserver_namespace, "uid")               : (1, 1),
+        (calendarserver_namespace, "uid")               : (0, 1),
         (dav_namespace, "href")                         : (1, 1),
         (calendarserver_namespace, "common-name")       : (0, 1),
         (calendarserver_namespace, "invite-noresponse") : (0, 1),
@@ -1014,7 +1014,8 @@
     name = "invite"
 
     allowed_children = {
-        (calendarserver_namespace, "user") : (0, None),
+        (calendarserver_namespace, "organizer") : (0, 1),
+        (calendarserver_namespace, "user")      : (0, None),
     }
 
 

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2012-06-29 15:10:20 UTC (rev 9398)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2012-06-29 15:11:18 UTC (rev 9399)
@@ -475,7 +475,6 @@
         if qname in self.liveProperties():
             if qname in (
                 element.DisplayName.qname(),
-                customxml.Invite.qname(),
             ):
                 return False
             else:

Modified: CalendarServer/trunk/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sharing.py	2012-06-29 15:10:20 UTC (rev 9398)
+++ CalendarServer/trunk/twistedcaldav/sharing.py	2012-06-29 15:11:18 UTC (rev 9399)
@@ -61,17 +61,38 @@
         Calculate the customxml.Invite property (for readProperty) from the
         invites database.
         """
-        isShared = yield self.isShared(request)
-        if config.Sharing.Enabled and isShared:
-            yield self.validateInvites()
-            records = yield self.invitesDB().allRecords()
-            returnValue(customxml.Invite(
-                *[record.makePropertyElement() for record in records]
-            ))
-        else:
-            returnValue(None)
+        if config.Sharing.Enabled:
+            
+            # See if this property is on the shared calendar
+            isShared = yield self.isShared(request)
+            if isShared:
+                yield self.validateInvites()
+                records = yield self.invitesDB().allRecords()
+                returnValue(customxml.Invite(
+                    *[record.makePropertyElement() for record in records]
+                ))
+                
+            # See if it is on the sharee calendar
+            if self.isVirtualShare():
+                original = (yield request.locateResource(self._share.hosturl))
+                yield original.validateInvites()
+                records = yield original.invitesDB().allRecords()
 
+                ownerPrincipal = (yield original.ownerPrincipal(request))
+                owner = ownerPrincipal.principalURL()
+                ownerCN = ownerPrincipal.displayName()
 
+                returnValue(customxml.Invite(
+                    customxml.Organizer(
+                        element.HRef.fromString(owner),
+                        customxml.CommonName.fromString(ownerCN),
+                    ),
+                    *[record.makePropertyElement(includeUID=False) for record in records]
+                ))
+
+        returnValue(None)
+
+
     def upgradeToShare(self):
         """ Upgrade this collection to a shared state """
         
@@ -889,10 +910,10 @@
         self.state = state
         self.summary = summary
         
-    def makePropertyElement(self):
+    def makePropertyElement(self, includeUID=True):
         
         return customxml.InviteUser(
-            customxml.UID.fromString(self.inviteuid),
+            customxml.UID.fromString(self.inviteuid) if includeUID else None,
             element.HRef.fromString(self.userid),
             customxml.CommonName.fromString(self.name),
             customxml.InviteAccess(inviteAccessMapToXML[self.access]()),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120629/bc314f2f/attachment-0001.html>


More information about the calendarserver-changes mailing list