[CalendarServer-changes] [5304] CalendarServer/branches/users/cdaboo/shared-calendars-5187/ twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 12 18:52:22 PST 2010


Revision: 5304
          http://trac.macosforge.org/projects/calendarserver/changeset/5304
Author:   cdaboo at apple.com
Date:     2010-03-12 18:52:19 -0800 (Fri, 12 Mar 2010)
Log Message:
-----------
Need to differentiate the owner of the "data" vs the owner of the "resource" as those
differ when sharing is in place.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/resource.py
    CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/scheduling/implicit.py

Modified: CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/resource.py	2010-03-12 22:35:06 UTC (rev 5303)
+++ CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/resource.py	2010-03-13 02:52:19 UTC (rev 5304)
@@ -280,7 +280,7 @@
         isvirt = (yield self.isVirtualShare(request))
         if self.isShadowableProperty(qname):
             if isvirt:
-                ownerPrincipal = (yield self.ownerPrincipal(request))
+                ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
                 p = self.deadProperties().get(qname, uid=ownerPrincipal.principalUID())
                 if p is not None:
                     returnValue(p)
@@ -289,7 +289,7 @@
                 returnValue(res)
             
         elif (not self.isGlobalProperty(qname)) and isvirt:
-            ownerPrincipal = (yield self.ownerPrincipal(request))
+            ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
             p = self.deadProperties().get(qname, uid=ownerPrincipal.principalUID())
             if p is not None:
                 returnValue(p)
@@ -339,7 +339,7 @@
                 # it and default to the old free-busy-set value.
                 if self.isCalendarCollection() and not self.hasDeadProperty(property):
                     # For backwards compatibility we need to sync this up with the calendar-free-busy-set on the inbox
-                    principal = (yield self.ownerPrincipal(request))
+                    principal = (yield self.resourceOwnerPrincipal(request))
                     fbset = (yield principal.calendarFreeBusyURIs(request))
                     url = (yield self.canonicalURL(request))
                     opaque = url in fbset
@@ -362,7 +362,7 @@
         # Per-user Dav props currently only apply to a sharee's copy of a calendar
         isvirt = (yield self.isVirtualShare(request))
         if isvirt and (self.isShadowableProperty(property.qname()) or (not self.isGlobalProperty(property.qname()))):
-            ownerPrincipal = (yield self.ownerPrincipal(request))
+            ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
             p = (yield self.deadProperties().set(property, uid=ownerPrincipal.principalUID()))
             returnValue(p)
  
@@ -409,7 +409,7 @@
                 ))
 
             # For backwards compatibility we need to sync this up with the calendar-free-busy-set on the inbox
-            principal = (yield self.ownerPrincipal(request))
+            principal = (yield self.resourceOwnerPrincipal(request))
             
             # Map owner to their inbox
             inboxURL = principal.scheduleInboxURL()
@@ -540,6 +540,14 @@
         d.addCallback(_gotParent)
         return d
 
+    def resourceOwnerPrincipal(self, request):
+        """
+        This is the owner of the resource based on the URI used to access it. For a shared
+        collection it will be the sharee, whereas the ownerPrincipal for a shared collection
+        will be the sharer.
+        """
+        return self.ownerPrincipal(request)
+
     def isOwner(self, request, adminprincipals=False, readprincipals=False):
         """
         Determine whether the DAV:owner of this resource matches the currently authorized principal
@@ -696,7 +704,7 @@
         """
         
         # For backwards compatibility we need to sync this up with the calendar-free-busy-set on the inbox
-        principal = (yield self.ownerPrincipal(request))
+        principal = (yield self.resourceOwnerPrincipal(request))
         inboxURL = principal.scheduleInboxURL()
         if inboxURL:
             inbox = (yield request.locateResource(inboxURL))
@@ -709,7 +717,7 @@
         """
         
         # For backwards compatibility we need to sync this up with the calendar-free-busy-set on the inbox
-        principal = (yield self.ownerPrincipal(request))
+        principal = (yield self.resourceOwnerPrincipal(request))
         inboxURL = principal.scheduleInboxURL()
         if inboxURL:
             (_ignore_scheme, _ignore_host, destination_path, _ignore_query, _ignore_fragment) = urlsplit(normalizeURL(destination_uri))
@@ -738,7 +746,7 @@
         assert self.isCalendarCollection()
         
         # Not allowed to delete the default calendar
-        principal = (yield self.ownerPrincipal(request))
+        principal = (yield self.resourceOwnerPrincipal(request))
         inboxURL = principal.scheduleInboxURL()
         if inboxURL:
             inbox = (yield request.locateResource(inboxURL))

Modified: CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/scheduling/implicit.py	2010-03-12 22:35:06 UTC (rev 5303)
+++ CalendarServer/branches/users/cdaboo/shared-calendars-5187/twistedcaldav/scheduling/implicit.py	2010-03-13 02:52:19 UTC (rev 5304)
@@ -379,7 +379,7 @@
             returnValue(None)
 
         # Get owner's calendar-home
-        calendar_owner_principal = (yield self.resource.ownerPrincipal(self.request))
+        calendar_owner_principal = (yield self.resource.resourceOwnerPrincipal(self.request))
         calendar_home = calendar_owner_principal.calendarHome()
         
         check_parent_uri = parentForURL(check_uri)[:-1] if check_uri else None
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100312/3053f7a1/attachment-0001.html>


More information about the calendarserver-changes mailing list