[CalendarServer-changes] [13042] CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/ directory/principal.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 28 18:34:14 PDT 2014


Revision: 13042
          http://trac.calendarserver.org//changeset/13042
Author:   sagen at apple.com
Date:     2014-03-28 18:34:13 -0700 (Fri, 28 Mar 2014)
Log Message:
-----------
defer principalForAuthID; remove unused isProxyFor(r1, r2)

Revision Links:
--------------
    http://trac.calendarserver.org//changeset/1
    http://trac.calendarserver.org//changeset/2

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py

Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py	2014-03-29 01:32:49 UTC (rev 13041)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py	2014-03-29 01:34:13 UTC (rev 13042)
@@ -186,19 +186,20 @@
         return self.principalForShortName(self.directory.recordType.lookupByName("user"), user)
 
 
+    @inlineCallbacks
     def principalForAuthID(self, user):
         # Basic/Digest creds -> just lookup user name
         if isinstance(user, UsernamePassword) or isinstance(user, DigestedCredentials):
-            return self.principalForUser(user.username)
+            returnValue((yield self.principalForUser(user.username)))
         elif NegotiateCredentials is not None and isinstance(user, NegotiateCredentials):
             authID = "Kerberos:%s" % (user.principal,)
-            principal = self.principalForRecord(self.directory.recordWithAuthID(authID))
+            principal = yield self.principalForRecord((yield self.directory.recordWithAuthID(authID)))
             if principal:
-                return principal
+                returnValue(principal)
             elif user.username:
-                return self.principalForUser(user.username)
+                returnValue((yield self.principalForUser(user.username)))
 
-        return None
+        returnValue(None)
 
 
     def principalForUID(self, uid):
@@ -416,30 +417,7 @@
         return (self,)
 
 
-    ##
-    # Proxy callback from directory service
-    ##
 
-    def isProxyFor(self, record1, record2):
-        """
-        Test whether the principal identified by directory record1 is a proxy for the principal identified by
-        record2.
-
-        @param record1: directory record for a user
-        @type record1: L{DirectoryRecord}
-        @param record2: directory record to test with
-        @type record2: L{DirectoryRercord}
-
-        @return: C{True} if record1 is a proxy for record2, otherwise C{False}
-        @rtype: C{bool}
-        """
-
-        principal1 = self.principalForUID(record1.uid)
-        principal2 = self.principalForUID(record2.uid)
-        return principal1.isProxyFor(principal2)
-
-
-
 class DirectoryPrincipalTypeProvisioningResource (DirectoryProvisioningResource):
     """
     Collection resource which provisions directory principals of a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140328/fd720bbc/attachment.html>


More information about the calendarserver-changes mailing list