[CalendarServer-changes] [982]
CalendarServer/branches/users/dreid/sudoers-3/twistedcaldav/
extensions.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jan 8 16:27:29 PST 2007
Revision: 982
http://trac.macosforge.org/projects/calendarserver/changeset/982
Author: dreid at apple.com
Date: 2007-01-08 16:27:29 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
Resolve conflicts and add SudoAuthIDMixin to __all__
Modified Paths:
--------------
CalendarServer/branches/users/dreid/sudoers-3/twistedcaldav/extensions.py
Modified: CalendarServer/branches/users/dreid/sudoers-3/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/branches/users/dreid/sudoers-3/twistedcaldav/extensions.py 2007-01-09 00:24:11 UTC (rev 981)
+++ CalendarServer/branches/users/dreid/sudoers-3/twistedcaldav/extensions.py 2007-01-09 00:27:29 UTC (rev 982)
@@ -24,6 +24,7 @@
"DAVResource",
"DAVFile",
"ReadOnlyResourceMixIn",
+ "SudoAuthIDMixin",
]
import urllib
@@ -42,11 +43,33 @@
from twisted.web2.dav.resource import DAVResource as SuperDAVResource
from twisted.web2.dav.resource import DAVPrincipalResource as SuperDAVPrincipalResource
-class DAVResource (SuperDAVResource):
+
+class SudoAuthIDMixin(object):
"""
+ Mixin class to let DAVResource, and DAVFile subclasses below know
+ about sudoer principals and how to find their AuthID
+ """
+
+ 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(SudoAuthIDMixin, self).findPrincipalForAuthID(authid)
+
+
+class DAVResource (SudoAuthIDMixin, SuperDAVResource):
+ """
Extended L{twisted.web2.dav.resource.DAVResource} implementation.
"""
+
class DAVPrincipalResource (SuperDAVPrincipalResource):
"""
Extended L{twisted.web2.dav.static.DAVFile} implementation.
@@ -71,7 +94,8 @@
else:
return davxml.ResourceType(davxml.Principal())
-class DAVFile (SuperDAVFile):
+
+class DAVFile (SudoAuthIDMixin, SuperDAVFile):
"""
Extended L{twisted.web2.dav.static.DAVFile} implementation.
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070108/f1f7b33c/attachment.html
More information about the calendarserver-changes
mailing list