[CalendarServer-changes] [13685] CalendarServer/branches/users/gaya/groupsharee2
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 25 07:48:40 PDT 2014
Revision: 13685
http://trac.calendarserver.org//changeset/13685
Author: gaya at apple.com
Date: 2014-06-25 07:48:40 -0700 (Wed, 25 Jun 2014)
Log Message:
-----------
add iCalendarStore effectiveShareMode() for group bind mode. Current code passes existing tests.
Modified Paths:
--------------
CalendarServer/branches/users/gaya/groupsharee2/conf/caldavd-test.plist
CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/sharing.py
CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py
CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/icalendarstore.py
CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/file.py
CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql.py
Modified: CalendarServer/branches/users/gaya/groupsharee2/conf/caldavd-test.plist
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/conf/caldavd-test.plist 2014-06-25 09:28:53 UTC (rev 13684)
+++ CalendarServer/branches/users/gaya/groupsharee2/conf/caldavd-test.plist 2014-06-25 14:48:40 UTC (rev 13685)
@@ -910,6 +910,11 @@
<dict>
<key>Enabled</key>
<true/>
+ <key>Groups</key>
+ <dict>
+ <key>Enabled</key>
+ <true/>
+ </dict>
</dict>
<key>AddressBooks</key>
<dict>
Modified: CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/sharing.py 2014-06-25 09:28:53 UTC (rev 13684)
+++ CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/sharing.py 2014-06-25 14:48:40 UTC (rev 13685)
@@ -293,7 +293,8 @@
else:
# Invited shares use access mode from the invite
# Get the access for self
- returnValue(invitationAccessFromBindModeMap.get(self._newStoreObject.shareMode()))
+ bindMode = yield self._newStoreObject.effectiveShareMode()
+ returnValue(invitationAccessFromBindModeMap.get(bindMode))
@inlineCallbacks
Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py 2014-06-25 09:28:53 UTC (rev 13684)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py 2014-06-25 14:48:40 UTC (rev 13685)
@@ -1896,6 +1896,23 @@
returnValue(changed)
+ @inlineCallbacks
+ def effectiveShareMode(self):
+ if self._bindMode == _BIND_MODE_GROUP:
+ gs = schema.GROUP_SHAREE
+ rows = yield Select(
+ [gs.GROUP_BIND_MODE],
+ From=gs,
+ Where=gs.HOME_ID == self.ownerHome()._resourceID.And(
+ gs.CALENDAR_ID == self._resourceID
+ )
+ ).on(self._txn)
+ groupShareMode = rows[0][0] if rows else None
+ returnValue(groupShareMode)
+ else:
+ returnValue(self._bindMode)
+
+
icalfbtype_to_indexfbtype = {
"UNKNOWN" : 0,
"FREE" : 1,
Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/icalendarstore.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/icalendarstore.py 2014-06-25 09:28:53 UTC (rev 13684)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/icalendarstore.py 2014-06-25 14:48:40 UTC (rev 13685)
@@ -405,6 +405,18 @@
"""
# TODO: implement this for the file store.
+ def effectiveShareMode(): #@NoSelf
+ """
+ The effective sharing mode of this calendar after group sharing is
+ considered
+
+ @see: L{ICalendar.viewerCalendarHome}
+ @return: a L{Deferred} which fires with C{BIND_*} constant or L{None}
+ if the mode is unknown
+
+ @rtype: L{Deferred}
+ """
+
# FIXME: This should be calendarHome(), assuming we want to allow
# back-references.
def viewerCalendarHome(): #@NoSelf
Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/file.py 2014-06-25 09:28:53 UTC (rev 13684)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/file.py 2014-06-25 14:48:40 UTC (rev 13685)
@@ -1084,6 +1084,13 @@
return _BIND_MODE_OWN
+ def effectiveShareMode(self):
+ """
+ Stub implementation of L{ICalendar.effectiveShareMode}; always returns L{_BIND_MODE_OWN}.
+ """
+ return _BIND_MODE_OWN
+
+
def owned(self):
return self._owned
Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql.py 2014-06-25 09:28:53 UTC (rev 13684)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql.py 2014-06-25 14:48:40 UTC (rev 13685)
@@ -5096,6 +5096,13 @@
return self._bindMode
+ def effectiveShareMode(self):
+ """
+ @see: L{ICalendar.shareMode}
+ """
+ return self._bindMode
+
+
def shareName(self):
"""
This is a path like name for the resource within the home being shared. For object resource
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140625/9f6ebc62/attachment.html>
More information about the calendarserver-changes
mailing list