[CalendarServer-changes] [1736]
CalendarServer/branches/users/wsanchez/deleted-uids/lib-patches/
Twisted/twisted.web2.dav.method.report_principal_match.patch
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 31 13:37:09 PDT 2007
Revision: 1736
http://trac.macosforge.org/projects/calendarserver/changeset/1736
Author: cdaboo at apple.com
Date: 2007-07-31 13:37:08 -0700 (Tue, 31 Jul 2007)
Log Message:
-----------
Make sure principal-match report supports alternate-URIs in principal resources.
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/deleted-uids/lib-patches/Twisted/twisted.web2.dav.method.report_principal_match.patch
Modified: CalendarServer/branches/users/wsanchez/deleted-uids/lib-patches/Twisted/twisted.web2.dav.method.report_principal_match.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/deleted-uids/lib-patches/Twisted/twisted.web2.dav.method.report_principal_match.patch 2007-07-30 23:40:00 UTC (rev 1735)
+++ CalendarServer/branches/users/wsanchez/deleted-uids/lib-patches/Twisted/twisted.web2.dav.method.report_principal_match.patch 2007-07-31 20:37:08 UTC (rev 1736)
@@ -2,7 +2,7 @@
===================================================================
--- twisted/web2/dav/method/report_principal_match.py (revision 19773)
+++ twisted/web2/dav/method/report_principal_match.py (working copy)
-@@ -89,40 +89,53 @@
+@@ -89,40 +89,61 @@
responses = []
matchcount = 0
@@ -25,6 +25,10 @@
- for child, uri in children:
- if isPrincipalResource(child) and child.principalMatch(selfPrincipal):
+- # Check size of results is within limit
+- matchcount += 1
+- if matchcount > max_number_of_matches:
+- raise NumberOfMatchesWithinLimits
+ # Find the set of principals that represent "self".
+
+ # First add "self"
@@ -39,26 +43,31 @@
+ # Now add each principal found to the response provided the principal resource is a child of
+ # the current resource.
+ for principal in selfItems:
-+ if principal.principalURL().startswith(request.uri):
- # Check size of results is within limit
- matchcount += 1
- if matchcount > max_number_of_matches:
- raise NumberOfMatchesWithinLimits
--
-+
- d = waitForDeferred(prop_common.responseForHref(
- request,
- responses,
-- davxml.HRef.fromString(uri),
-- child,
-+ davxml.HRef.fromString(principal.principalURL()),
-+ principal,
- propertiesForResource,
- propElement
- ))
- yield d
- d.getResult()
- else:
++ # Get all the URIs that point to the principal resource
++ # FIXME: making the assumption that the principalURL() is the URL of the resource we found
++ principal_uris = [principal.principalURL()]
++ principal_uris.extend(principal.alternateURIs())
++
++ # Compare each one to the request URI and return at most one that matches
++ for uri in principal_uris:
++ if uri.startswith(request.uri):
++ # Check size of results is within limit
++ matchcount += 1
++ if matchcount > max_number_of_matches:
++ raise NumberOfMatchesWithinLimits
++
++ d = waitForDeferred(prop_common.responseForHref(
++ request,
++ responses,
++ davxml.HRef.fromString(uri),
++ principal,
++ propertiesForResource,
++ propElement
++ ))
++ yield d
++ d.getResult()
++ break
++ else:
+ # Do some optimisation of access control calculation by determining any inherited ACLs outside of
+ # the child resource loop and supply those to the checkPrivileges on each child.
+ filteredaces = waitForDeferred(self.inheritedACEsforChildren(request))
@@ -70,11 +79,22 @@
+ privileges=(davxml.Read(),), inherited_aces=filteredaces))
+ yield d
+ d.getResult()
-+
+
+- d = waitForDeferred(prop_common.responseForHref(
+- request,
+- responses,
+- davxml.HRef.fromString(uri),
+- child,
+- propertiesForResource,
+- propElement
+- ))
+- yield d
+- d.getResult()
+- else:
for child, uri in children:
# Try to read the requested property from this resource
try:
-@@ -137,7 +150,7 @@
+@@ -137,7 +158,7 @@
yield principal
principal = principal.getResult()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070731/77933499/attachment.html
More information about the calendarserver-changes
mailing list