[CalendarServer-changes] [9423] CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing .py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 10 15:57:46 PDT 2012
Revision: 9423
http://trac.macosforge.org/projects/calendarserver/changeset/9423
Author: gaya at apple.com
Date: 2012-07-10 15:57:46 -0700 (Tue, 10 Jul 2012)
Log Message:
-----------
don't use self.invitesDB().recordForUserID(); remove validUserIDForShare()
Modified Paths:
--------------
CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py 2012-07-10 19:36:01 UTC (rev 9422)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py 2012-07-10 22:57:46 UTC (rev 9423)
@@ -388,31 +388,6 @@
returnValue(element.ACL(*aces))
- def validUserIDForShare(self, userid):
- """
- Test the user id to see if it is a valid identifier for sharing and
- return a "normalized" form for our own use (e.g. convert mailto: to
- urn:uuid).
-
- @param userid: the userid to test
- @type userid: C{str}
-
- @return: C{str} of normalized userid or C{None} if
- userid is not allowed.
- """
-
- # First try to resolve as a principal
- principal = self.principalForCalendarUserAddress(userid)
- if principal:
- return principal.principalURL()
-
- # TODO: we do not support external users right now so this is being hard-coded
- # off in spite of the config option.
- #elif config.Sharing.AllowExternalUsers:
- # return userid
- else:
- return None
-
@inlineCallbacks
def validateInvites(self):
"""
@@ -421,7 +396,7 @@
records = yield self.invitesDB().allRecords()
for record in records:
- if self.validUserIDForShare(record.userid) is None and record.state != "INVALID":
+ if not self.principalForCalendarUserAddress(record.userid) and record.state != "INVALID":
record.state = "INVALID"
yield self.invitesDB().addOrUpdateRecord(record)
@@ -559,9 +534,7 @@
if not principal:
returnValue(False)
- # add code below to convert from "mailto:" + xxxx form of userid
- # principalUID = principal.principalUID()
- # userid = "urn:uuid:" + principalUID
+ principalUID = principal.principalUID()
# Acquire a memcache lock based on collection URL and sharee UID
# TODO: when sharing moves into the store this should be replaced
@@ -570,7 +543,7 @@
yield self._acquireLock(lock)
try:
- record = yield self.invitesDB().recordForUserID(userid)
+ record = yield self.invitesDB().recordForPrincipalUID(principalUID)
if record:
result = (yield self.uninviteRecordFromShare(record, request))
else:
@@ -750,7 +723,7 @@
setDict[userid] = (cn, access, summary)
# Validate each userid on add only
- (okusers if self.validUserIDForShare(userid) else badusers).add(userid)
+ (okusers if self.principalForCalendarUserAddress(userid) else badusers).add(userid)
elif isinstance(item, customxml.InviteRemove):
userid, access = _handleInviteRemove(item)
removeDict[userid] = access
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120710/af9f7803/attachment.html>
More information about the calendarserver-changes
mailing list