[CalendarServer-changes] [6234] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 2 16:30:12 PDT 2010
Revision: 6234
http://trac.macosforge.org/projects/calendarserver/changeset/6234
Author: sagen at apple.com
Date: 2010-09-02 16:30:12 -0700 (Thu, 02 Sep 2010)
Log Message:
-----------
Honor wiki auth if it's already set the authnUser and authzUser
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/provision/root.py
CalendarServer/trunk/twext/web2/dav/resource.py
CalendarServer/trunk/twistedcaldav/extensions.py
Modified: CalendarServer/trunk/calendarserver/provision/root.py
===================================================================
--- CalendarServer/trunk/calendarserver/provision/root.py 2010-09-01 19:44:54 UTC (rev 6233)
+++ CalendarServer/trunk/calendarserver/provision/root.py 2010-09-02 23:30:12 UTC (rev 6234)
@@ -188,7 +188,7 @@
break
if principal:
- log.debug("Wiki-authenticated principal %s being assigned to authnUser" % (record.guid,))
+ log.debug("Wiki-authenticated principal %s being assigned to authnUser and authzUser" % (record.guid,))
request.authzUser = request.authnUser = davxml.Principal(
davxml.HRef.fromString("/principals/__uids__/%s/" % (record.guid,))
)
@@ -206,17 +206,19 @@
# This is a wiki-related resource. SACLs are not checked.
request.checkedSACL = True
- # The authzuser value is set to that of the wiki principal.
- wikiName = None
- if segments[1] == "wikis":
- wikiName = segments[2]
- else:
- wikiName = segments[2][5:]
- if wikiName:
- log.debug("Wiki principal %s being assigned to authzUser" % (wikiName,))
- request.authzUser = davxml.Principal(
- davxml.HRef.fromString("/principals/wikis/%s/" % (wikiName,))
- )
+ # The authzuser value is set to that of the wiki principal if
+ # not already set.
+ if not hasattr(request, "authzUser"):
+ wikiName = None
+ if segments[1] == "wikis":
+ wikiName = segments[2]
+ else:
+ wikiName = segments[2][5:]
+ if wikiName:
+ log.debug("Wiki principal %s being assigned to authzUser" % (wikiName,))
+ request.authzUser = davxml.Principal(
+ davxml.HRef.fromString("/principals/wikis/%s/" % (wikiName,))
+ )
elif self.useSacls and not hasattr(request, "checkedSACL") and not hasattr(request, "checkingSACL"):
yield self.checkSacl(request)
Modified: CalendarServer/trunk/twext/web2/dav/resource.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/resource.py 2010-09-01 19:44:54 UTC (rev 6233)
+++ CalendarServer/trunk/twext/web2/dav/resource.py 2010-09-02 23:30:12 UTC (rev 6234)
@@ -1009,6 +1009,14 @@
d.addCallbacks(gotAuth, translateUnauthenticated)
return d
else:
+ if (
+ hasattr(request, "checkedWiki") and
+ hasattr(request, "authnUser") and
+ hasattr(request, "authzUser")
+ ):
+ # This request has already been authenticated via the wiki
+ return succeed((request.authnUser, request.authzUser))
+
request.authnUser = davxml.Principal(davxml.Unauthenticated())
request.authzUser = davxml.Principal(davxml.Unauthenticated())
return succeed((request.authnUser, request.authzUser))
Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py 2010-09-01 19:44:54 UTC (rev 6233)
+++ CalendarServer/trunk/twistedcaldav/extensions.py 2010-09-02 23:30:12 UTC (rev 6234)
@@ -150,6 +150,14 @@
request.authzUser = result[2]
returnValue((request.authnUser, request.authzUser,))
else:
+ if (
+ hasattr(request, "checkedWiki") and
+ hasattr(request, "authnUser") and
+ hasattr(request, "authzUser")
+ ):
+ # This request has already been authenticated via the wiki
+ returnValue((request.authnUser, request.authzUser))
+
request.authnUser = davxml.Principal(davxml.Unauthenticated())
request.authzUser = davxml.Principal(davxml.Unauthenticated())
returnValue((request.authnUser, request.authzUser,))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100902/5641634b/attachment.html>
More information about the calendarserver-changes
mailing list