[CalendarServer-changes] [977] CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 8 15:05:44 PST 2007


Revision: 977
          http://trac.macosforge.org/projects/calendarserver/changeset/977
Author:   dreid at apple.com
Date:     2007-01-08 15:05:44 -0800 (Mon, 08 Jan 2007)

Log Message:
-----------
Cleanup

Modified Paths:
--------------
    CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/directory/xmlaccountsparser.py
    CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/extensions.py
    CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/tap.py

Modified: CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/directory/xmlaccountsparser.py
===================================================================
--- CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/directory/xmlaccountsparser.py	2007-01-08 22:28:43 UTC (rev 976)
+++ CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/directory/xmlaccountsparser.py	2007-01-08 23:05:44 UTC (rev 977)
@@ -42,7 +42,6 @@
 ELEMENT_MEMBERS      = "members"
 ELEMENT_MEMBER       = "member"
 ELEMENT_CUADDR       = "cuaddr"
-# ELEMENT_CANPROXY     = "canproxy"
 
 ATTRIBUTE_REALM      = "realm"
 ATTRIBUTE_REPEAT     = "repeat"
@@ -129,7 +128,6 @@
         self.members = set()
         self.groups = set()
         self.calendarUserAddresses = set()
-#         self.canproxy = False
 
     def repeat(self, ctr):
         """
@@ -162,7 +160,6 @@
         result.name = name
         result.members = self.members
         result.calendarUserAddresses = calendarUserAddresses
-#         result.canproxy = self.canproxy
         return result
 
     def parseXML(self, node):
@@ -181,9 +178,6 @@
             elif child._get_localName() == ELEMENT_CUADDR:
                 if child.firstChild is not None:
                     self.calendarUserAddresses.add(child.firstChild.data.encode("utf-8"))
-#             elif child._get_localName() == ELEMENT_CANPROXY:
-#                 CalDAVResource.proxyUsers.add(self.shortName)
-#                 self.canproxy = True
 
     def _parseMembers(self, node):
         for child in node._get_childNodes():

Modified: CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/extensions.py	2007-01-08 22:28:43 UTC (rev 976)
+++ CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/extensions.py	2007-01-08 23:05:44 UTC (rev 977)
@@ -41,9 +41,11 @@
 from twisted.web2.dav.static import DAVFile as SuperDAVFile
 from twisted.web2.dav.resource import DAVResource as SuperDAVResource
 
-class DAVResource (SuperDAVResource):
+
+class SudoAuthIDMixin(object):
     """
-    Extended L{twisted.web2.dav.resource.DAVResource} implementation.
+    Mixin class to let DAVResource, and DAVFile subclasses below know
+    about sudoer principals and how to find their AuthID
     """
 
     def findPrincipalForAuthID(self, authid):
@@ -57,10 +59,16 @@
             if principal is not None:
                 return principal
 
-        return super(DAVFile, self).findPrincipalForAuthID(authid)
+        return super(SudoAuthIDMixin, self).findPrincipalForAuthID(authid)
 
-class DAVFile (SuperDAVFile):
+
+class DAVResource (SuperDAVResource, SudoAuthIDMixin):
     """
+    Extended L{twisted.web2.dav.resource.DAVResource} implementation.
+    """
+
+class DAVFile (SuperDAVFile, SudoAuthIDMixin):
+    """
     Extended L{twisted.web2.dav.static.DAVFile} implementation.
     """
     def readProperty(self, property, request):
@@ -226,21 +234,7 @@
         response.headers.setHeader("content-type", MimeType("text", "html"))
         return response
 
-    def findPrincipalForAuthID(self, authid):
-        """
-        Return an authentication and authorization principal identifiers for 
-        the authentication identifier passed in.  Check for sudo users before
-        regular users.
-        """
 
-        for collection in self.principalCollections():
-            principal = collection.principalForShortName('sudoer', authid)
-            if principal is not None:
-                return principal
-
-        return super(DAVFile, self).findPrincipalForAuthID(authid)
-
-
 class ReadOnlyResourceMixIn (object):
     """
     Read only resource.

Modified: CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/tap.py
===================================================================
--- CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/tap.py	2007-01-08 22:28:43 UTC (rev 976)
+++ CalendarServer/branches/users/dreid/sudoers-2/twistedcaldav/tap.py	2007-01-08 23:05:44 UTC (rev 977)
@@ -205,12 +205,6 @@
 
         portal.registerChecker(directory)
 
-        # FIXME: This is a hack, why doesn't aggregate directory service 
-        # do the right thing.
-
-#         if sudoDirectory:
-#             portal.registerChecker(sudoDirectory)
-
         realm = directory.realmName or ""
 
         for scheme, schemeConfig in config.Authentication.iteritems():

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070108/71026bfe/attachment.html


More information about the calendarserver-changes mailing list