[CalendarServer-changes] [9722] CalendarServer/branches/users/gaya/inviteclean

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 16 20:40:23 PDT 2012


Revision: 9722
          http://trac.macosforge.org/projects/calendarserver/changeset/9722
Author:   gaya at apple.com
Date:     2012-08-16 20:40:21 -0700 (Thu, 16 Aug 2012)
Log Message:
-----------
fix SharedCollectionMixin.shareeAccessControlList(). Don't return self from CommonHomeChild.asShared() and CommonHomeChild.asInvited()

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
    CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py

Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py	2012-08-17 01:54:53 UTC (rev 9721)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py	2012-08-17 03:40:21 UTC (rev 9722)
@@ -321,15 +321,9 @@
                     **kwargs))
                 returnValue(result)
         else:
-            # Invite shares use access mode from the invite
-    
-            # Get the invite for this sharee
-            invitation = yield self._invitationForUID(
-                self._share.uid()
-            )
-            if invitation is None:
-                returnValue(element.ACL())
-            access = invitation.access()
+            # Invited shares use access mode from the invite
+            # Get the access for self
+            access = Invitation(self._newStoreObject).access()
             
         userprivs = [
         ]

Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-08-17 01:54:53 UTC (rev 9721)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-08-17 03:40:21 UTC (rev 9722)
@@ -2336,9 +2336,10 @@
         )
 
     @classproperty
-    def _sharedBindForResourceID(cls): #@NoSelf
+    def _sharedBindForResourceIDAndNotHomeID(cls): #@NoSelf
         bind = cls._bindSchema
         return cls._bindFor((bind.RESOURCE_ID == Parameter("resourceID"))
+                            .And(bind.HOME_RESOURCE_ID != Parameter("homeID"))
                             .And(bind.BIND_STATUS == _BIND_STATUS_ACCEPTED)
                             .And(bind.BIND_MODE != _BIND_MODE_OWN)
                             )
@@ -2358,7 +2359,9 @@
         @rtype: a L{Deferred} which fires with a L{list} of L{ICalendar}s.
         """
         # get all accepted binds
-        acceptedRows = yield self._sharedBindForResourceID.on(self._txn, resourceID=self._resourceID)
+        acceptedRows = yield self._sharedBindForResourceIDAndNotHomeID.on(
+            self._txn, resourceID=self._resourceID, homeID=self._home._resourceID
+        )
 
         cls = self.__class__ # for ease of grepping...
         result = []
@@ -2379,9 +2382,10 @@
 
 
     @classproperty
-    def _invitedBindForResourceID(cls): #@NoSelf
+    def _invitedBindForResourceIDAndNotHomeID(cls): #@NoSelf
         bind = cls._bindSchema
         return cls._bindFor((bind.RESOURCE_ID == Parameter("resourceID"))
+                            .And(bind.HOME_RESOURCE_ID != Parameter("homeID"))
                             .And(bind.BIND_STATUS != _BIND_STATUS_ACCEPTED)
                             )
 
@@ -2397,8 +2401,8 @@
             L{CommonHomeChild} as a child of different L{CommonHome}s
         @rtype: a L{Deferred} which fires with a L{list} of L{ICalendar}s.
         """
-        rows = yield self._invitedBindForResourceID.on(
-            self._txn, resourceID=self._resourceID
+        rows = yield self._invitedBindForResourceIDAndNotHomeID.on(
+            self._txn, resourceID=self._resourceID, homeID=self._home._resourceID,
         )
         cls = self.__class__ # for ease of grepping...
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120816/a02f5959/attachment.html>


More information about the calendarserver-changes mailing list