[CalendarServer-changes] [114]
CalendarServer/branches/users/cdaboo/acl-merge
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 11 09:00:02 PDT 2006
Revision: 114
Author: cdaboo at apple.com
Date: 2006-09-11 09:00:00 -0700 (Mon, 11 Sep 2006)
Log Message:
-----------
Sync to latest Twisted acl branch changes.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.resource.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.static.patch
CalendarServer/branches/users/cdaboo/acl-merge/run
Removed Paths:
-------------
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.auth.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.idav.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.acl.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.prop_common.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.propfind.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.proppatch.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_acl_principal_prop_set.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_match.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch
CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_search_property_set.patch
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.auth.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.auth.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.auth.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,13 +0,0 @@
-Index: twisted/web2/dav/auth.py
-===================================================================
---- twisted/web2/dav/auth.py (revision 17966)
-+++ twisted/web2/dav/auth.py (working copy)
-@@ -8,8 +8,6 @@
-
- __all__ = ["PrincipalCredentials", "AuthenticationWrapper"]
-
--__all__ = ["PrincipalCredentials"]
--
- class AuthenticationWrapper(WrapperResource):
- def __init__(self, resource, portal, credentialFactories, loginInterfaces):
- """Wrap the given resource and use the parameters to set up the request
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.idav.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.idav.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.idav.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,27 +0,0 @@
-Index: twisted/web2/dav/idav.py
-===================================================================
---- twisted/web2/dav/idav.py (revision 17940)
-+++ twisted/web2/dav/idav.py (working copy)
-@@ -153,8 +153,8 @@
- def supportedPrivileges(request):
- """
- @param request: the request being processed.
-- @return: a L{davxml.SupportedPrivilegeSet} describing the the access
-- control privileges which are supported by this resource.
-+ @return: a L{Deferred} with an L{davxml.SupportedPrivilegeSet} result describing
-+ the access control privileges which are supported by this resource.
- """
-
- def currentPrivileges(request):
-@@ -219,11 +219,3 @@
- directly a member. (RFC 3744, section 4.4)
- @return: a iterable of group principal URLs.
- """
--
-- def checkCredentials(creds):
-- """
-- Check whether the provided credentials can be used to authenticate this
-- prinicpal.
-- @param creds: the L{ICredentials} for testing.
-- @return: C{True} if the credentials match, C{False} otherwise
-- """
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.acl.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.acl.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.acl.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,15 +0,0 @@
-Index: twisted/web2/dav/method/acl.py
-===================================================================
---- twisted/web2/dav/method/acl.py (revision 17951)
-+++ twisted/web2/dav/method/acl.py (working copy)
-@@ -85,7 +85,9 @@
- #
- # Do ACL merger
- #
-- result = self.mergeAccessControlList(acl, request)
-+ result = waitForDeferred(self.mergeAccessControlList(acl, request))
-+ yield result
-+ result = result.getResult()
-
- #
- # Return response
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.prop_common.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.prop_common.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.prop_common.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,66 +0,0 @@
-Index: twisted/web2/dav/method/prop_common.py
-===================================================================
---- twisted/web2/dav/method/prop_common.py (revision 17951)
-+++ twisted/web2/dav/method/prop_common.py (working copy)
-@@ -12,6 +12,7 @@
- "propertyListForResource",
- ]
-
-+from twisted.internet.defer import deferredGenerator, waitForDeferred
- from twisted.python import log
- from twisted.python.failure import Failure
- from twisted.web2 import responsecode
-@@ -19,7 +20,6 @@
- from twisted.web2.dav.element.base import WebDAVElement
- from twisted.web2.dav.http import statusForFailure
- from twisted.web2.dav.method.propfind import propertyName
--from twisted.web2.dav.util import joinURL
-
- # def applyToCollections(resource, request_uri, depth, apply):
- # """
-@@ -56,7 +56,9 @@
- def responseForHref(request, responses, href, resource, propertiesForResource, propertyreq):
-
- if propertiesForResource is not None:
-- properties_by_status = propertiesForResource(request, propertyreq, resource)
-+ properties_by_status = waitForDeferred(propertiesForResource(request, propertyreq, resource))
-+ yield properties_by_status
-+ properties_by_status = properties_by_status.getResult()
-
- for status in properties_by_status:
- properties = properties_by_status[status]
-@@ -78,6 +80,8 @@
- )
- )
-
-+responseForHref = deferredGenerator(responseForHref)
-+
- # def allPropertiesForResource(request, prop, resource):
- # """
- # Return all (non-hidden) properties for the specified resource.
-@@ -134,9 +138,15 @@
- else:
- qname = property
-
-- if qname in resource.listProperties(request):
-+ props = waitForDeferred(resource.listProperties(request))
-+ yield props
-+ props = props.getResult()
-+ if qname in props:
- try:
-- properties_by_status[responsecode.OK].append(resource.readProperty(qname, request))
-+ prop = waitForDeferred(resource.readProperty(qname, request))
-+ yield prop
-+ prop = prop.getResult()
-+ properties_by_status[responsecode.OK].append(prop)
- except:
- f = Failure()
-
-@@ -149,4 +159,6 @@
- log.err("Can't find property %r for resource %s" % (qname, request.uri))
- properties_by_status[responsecode.NOT_FOUND].append(propertyName(qname))
-
-- return properties_by_status
-+ yield properties_by_status
-+
-+_namedPropertiesForResource = deferredGenerator(_namedPropertiesForResource)
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.propfind.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.propfind.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.propfind.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,36 +0,0 @@
-Index: twisted/web2/dav/method/propfind.py
-===================================================================
---- twisted/web2/dav/method/propfind.py (revision 17951)
-+++ twisted/web2/dav/method/propfind.py (working copy)
-@@ -48,6 +48,13 @@
- raise HTTPError(responsecode.NOT_FOUND)
-
- #
-+ # Check authentication and access controls
-+ #
-+ x = waitForDeferred(self.securityCheck(request, (davxml.Read(),)))
-+ yield x
-+ x.getResult()
-+
-+ #
- # Read request body
- #
- try:
-@@ -99,7 +106,7 @@
-
- resources = [(self, None)]
-
-- d = self.findChildren(depth, request, lambda x, y: resources.append((x, y)))
-+ d = self.findChildren(depth, request, lambda x, y: resources.append((x, y)), (davxml.Read(),))
- ign = waitForDeferred(d)
- yield ign
- ign.getResult()
-@@ -108,8 +115,6 @@
- if uri is None:
- uri = normalizeURL(request_uri)
- if self.isCollection() and not uri.endswith("/"): uri += "/"
-- else:
-- uri = joinURL(request_uri, uri)
-
- resource_properties = waitForDeferred(resource.listProperties(request))
- yield resource_properties
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.proppatch.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.proppatch.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.proppatch.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,15 +0,0 @@
-Index: twisted/web2/dav/method/proppatch.py
-===================================================================
---- twisted/web2/dav/method/proppatch.py (revision 17951)
-+++ twisted/web2/dav/method/proppatch.py (working copy)
-@@ -117,8 +117,8 @@
- x = waitForDeferred(action(property, request))
- yield x
- x.getResult()
-- except ValueError, e:
-- # Convert ValueError exception into HTTPError
-+ except KeyError, e:
-+ # Convert KeyError exception into HTTPError
- responses.add(
- Failure(exc_value=HTTPError(StatusResponse(responsecode.FORBIDDEN, str(e)))),
- property
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,38 +0,0 @@
-Index: twisted/web2/dav/method/report.py
-===================================================================
---- twisted/web2/dav/method/report.py (revision 17951)
-+++ twisted/web2/dav/method/report.py (working copy)
-@@ -36,6 +36,7 @@
- from twisted.web2 import responsecode
- from twisted.web2.http import HTTPError, StatusResponse
- from twisted.web2.dav import davxml
-+from twisted.web2.dav.element.parser import lookupElement
- from twisted.web2.dav.http import ErrorResponse
- from twisted.web2.dav.util import davXMLFromStream
-
-@@ -99,6 +100,15 @@
-
- try:
- method = getattr(self, method_name)
-+
-+ # Also double-check via supported-reports property
-+ reports = self.supportedReports()
-+ test = lookupElement((namespace, name))
-+ if not test:
-+ raise AttributeError()
-+ test = davxml.Report(test())
-+ if test not in reports:
-+ raise AttributeError()
- except AttributeError:
- #
- # Requested report is not supported.
-@@ -111,6 +121,8 @@
- davxml.SupportedReport()
- ))
-
-- yield method(request, doc.root_element)
-+ d = waitForDeferred(method(request, doc.root_element))
-+ yield d
-+ yield d.getResult()
-
- http_REPORT = deferredGenerator(http_REPORT)
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_acl_principal_prop_set.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_acl_principal_prop_set.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_acl_principal_prop_set.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,47 +0,0 @@
-Index: twisted/web2/dav/method/report_acl_principal_prop_set.py
-===================================================================
---- twisted/web2/dav/method/report_acl_principal_prop_set.py (revision 17966)
-+++ twisted/web2/dav/method/report_acl_principal_prop_set.py (working copy)
-@@ -53,9 +53,8 @@
- # Depth must be "0"
- depth = request.headers.getHeader("depth", "0")
- if depth != "0":
-- log.err("Non-zero depth is not allowed: %s" % (depth,))
-- yield StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,))
-- return
-+ log.err("Error in prinicpal-prop-set REPORT, Depth set to %s" % (depth,))
-+ raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
-
- #
- # Check authentication and access controls
-@@ -90,7 +89,9 @@
- acl = acl.getResult()
-
- for ace in acl.children:
-- resolved = self.resolvePrincipal(ace.principal.children[0], request)
-+ resolved = waitForDeferred(self.resolvePrincipal(ace.principal.children[0], request))
-+ yield resolved
-+ resolved = resolved.getResult()
- if resolved is not None and resolved not in principals:
- principals.append(resolved)
-
-@@ -122,7 +123,7 @@
- davxml.Status.fromResponseCode(responsecode.FORBIDDEN)
- ))
- else:
-- prop_common.responseForHref(
-+ d = waitForDeferred(prop_common.responseForHref(
- request,
- responses,
- principal,
-@@ -129,7 +130,9 @@
- resource,
- propertiesForResource,
- propElement
-- )
-+ ))
-+ yield d
-+ d.getResult()
- else:
- log.err("Requested principal resource not found: %s" % (str(principal),))
- responses.append(davxml.StatusResponse(
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_match.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_match.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_match.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,93 +0,0 @@
-Index: twisted/web2/dav/method/report_principal_match.py
-===================================================================
---- twisted/web2/dav/method/report_principal_match.py (revision 17951)
-+++ twisted/web2/dav/method/report_principal_match.py (working copy)
-@@ -56,8 +56,7 @@
- depth = request.headers.getHeader("depth", "0")
- if depth != "0":
- log.err("Non-zero depth is not allowed: %s" % (depth,))
-- yield StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,))
-- return
-+ raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
-
- # Get a single DAV:prop element from the REPORT request body
- propertiesForResource = None
-@@ -94,7 +93,12 @@
- if lookForPrincipals:
- selfPrincipal = self.currentPrincipal(request).children[0]
-
-- for child, uri in self.findChildrenWithPrivileges("infinity", (davxml.Read(),), request):
-+ children = []
-+ d = waitForDeferred(self.findChildren("infinity", request, lambda x, y: children.append((x,y)), privileges=(davxml.Read(),)))
-+ yield d
-+ d.getResult()
-+
-+ for child, uri in children:
- if isPrincipalResource(child) and child.principalMatch(selfPrincipal):
- # Check size of results is within limit
- matchcount += 1
-@@ -101,21 +105,30 @@
- if matchcount > max_number_of_matches:
- raise NumberOfMatchesWithinLimits
-
-- prop_common.responseForHref(
-+ d = waitForDeferred(prop_common.responseForHref(
- request,
- responses,
-- davxml.HRef.fromString(joinURL(request.uri, uri)),
-+ davxml.HRef.fromString(uri),
- child,
- propertiesForResource,
- propElement
-- )
-+ ))
-+ yield d
-+ d.getResult()
- else:
- selfPrincipal = self.currentPrincipal(request).children[0]
-
-- for child, uri in self.findChildrenWithPrivileges("infinity", (davxml.Read(),), request):
-+ children = []
-+ d = waitForDeferred(self.findChildren("infinity", request, lambda x, y: children.append((x,y)), privileges=(davxml.Read(),)))
-+ yield d
-+ d.getResult()
-+
-+ for child, uri in children:
- # Try to read the requested property from this resource
- try:
-- prop = child.readProperty(principalPropElement.qname(), request)
-+ prop = waitForDeferred(child.readProperty(principalPropElement.qname(), request))
-+ yield prop
-+ prop = prop.getResult()
- if prop: prop.removeWhitespaceNodes()
-
- if prop and len(prop.children) == 1 and isinstance(prop.children[0], davxml.HRef):
-@@ -120,7 +133,7 @@
-
- if prop and len(prop.children) == 1 and isinstance(prop.children[0], davxml.HRef):
- # Find principal associated with this property and test it
-- principal = waitForDeferred(self.locateResource(str(prop.children[0])))
-+ principal = waitForDeferred(request.locateResource(str(prop.children[0])))
- yield principal
- principal = principal.getResult()
-
-@@ -130,14 +143,16 @@
- if matchcount > max_number_of_matches:
- raise NumberOfMatchesWithinLimits
-
-- prop_common.responseForHref(
-+ d = waitForDeferred(prop_common.responseForHref(
- request,
- responses,
-- davxml.HRef.fromString(joinURL(request.uri, uri)),
-+ davxml.HRef.fromString(uri),
- child,
- propertiesForResource,
- propElement
-- )
-+ ))
-+ yield d
-+ d.getResult()
- except HTTPError:
- # Just ignore a failure to access the property. We treat this like a property that does not exist
- # or does not match the principal.
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_property_search.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,89 +0,0 @@
-Index: twisted/web2/dav/method/report_principal_property_search.py
-===================================================================
---- twisted/web2/dav/method/report_principal_property_search.py (revision 18009)
-+++ twisted/web2/dav/method/report_principal_property_search.py (working copy)
-@@ -56,8 +56,7 @@
- depth = request.headers.getHeader("depth", "0")
- if depth != "0":
- log.err("Error in prinicpal-property-search REPORT, Depth set to %s" % (depth,))
-- yield StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,))
-- return
-+ raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
-
- # Get a single DAV:prop element from the REPORT request body
- propertiesForResource = None
-@@ -107,15 +106,21 @@
- # Test each property
- for prop in props:
- try:
-- propvalue = resource.readProperty(prop.qname(), request)
-+ propvalue = waitForDeferred(resource.readProperty(prop.qname(), request))
-+ yield propvalue
-+ propvalue = propvalue.getResult()
- if propvalue and not nodeMatch(propvalue, match):
-- return False
-+ yield False
-+ return
- except HTTPError:
- # No property => no match
-- return False
-+ yield False
-+ return
-
-- return True
--
-+ yield True
-+
-+ propertySearch = deferredGenerator(propertySearch)
-+
- # Run report
- try:
- resources = []
-@@ -140,21 +145,33 @@
-
- # Loop over all collections and principal resources within
- for resource, ruri in resources:
-- for child, uri in resource.findChildrenWithPrivileges("infinity", (davxml.Read(),), request):
-- if isPrincipalResource(child) and propertySearch(child, request):
-- # Check size of results is within limit
-- matchcount += 1
-- if matchcount > max_number_of_matches:
-- raise NumberOfMatchesWithinLimits
-+
-+ children = []
-+ d = waitForDeferred(resource.findChildren("infinity", request, lambda x, y: children.append((x,y)), privileges=(davxml.Read(),)))
-+ yield d
-+ d.getResult()
-
-- prop_common.responseForHref(
-- request,
-- responses,
-- davxml.HRef.fromString(joinURL(ruri, uri)),
-- child,
-- propertiesForResource,
-- propElement
-- )
-+ for child, uri in children:
-+ if isPrincipalResource(child):
-+ d = waitForDeferred(propertySearch(child, request))
-+ yield d
-+ d = d.getResult()
-+ if d:
-+ # 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,
-+ propertiesForResource,
-+ propElement
-+ ))
-+ yield d
-+ d.getResult()
-
- except NumberOfMatchesWithinLimits:
- log.err("Too many matching components in prinicpal-property-search report")
Deleted: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_search_property_set.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_search_property_set.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.method.report_principal_search_property_set.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,38 +0,0 @@
-Index: twisted/web2/dav/method/report_principal_search_property_set.py
-===================================================================
---- twisted/web2/dav/method/report_principal_search_property_set.py (revision 17951)
-+++ twisted/web2/dav/method/report_principal_search_property_set.py (working copy)
-@@ -29,11 +29,11 @@
-
- __all__ = ["report_DAV__principal_search_property_set"]
-
-+from twisted.internet.defer import deferredGenerator
- from twisted.python import log
- from twisted.web2 import responsecode
- from twisted.web2.dav import davxml
--from twisted.web2.http import Response
--from twisted.web2.http import StatusResponse
-+from twisted.web2.http import HTTPError, Response, StatusResponse
- from twisted.web2.stream import MemoryStream
-
- def report_DAV__principal_search_property_set(self, request, principal_search_property_set):
-@@ -49,7 +49,7 @@
- depth = request.headers.getHeader("depth", "0")
- if depth != "0":
- log.err("Error in principal-search-property-set REPORT, Depth set to %s" % (depth,))
-- return StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,))
-+ raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
-
- # Get details from the resource
- result = self.principalSearchPropertySet()
-@@ -55,6 +55,8 @@
- result = self.principalSearchPropertySet()
- if result is None:
- log.err("Error in principal-search-property-set REPORT not supported on: %s" % (self,))
-- return StatusResponse(responsecode.BAD_REQUEST, "Not allowed on this resource")
-+ raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Not allowed on this resource"))
-
-- return Response(code=responsecode.OK, stream=MemoryStream(result.toxml()))
-+ yield Response(code=responsecode.OK, stream=MemoryStream(result.toxml()))
-+
-+report_DAV__principal_search_property_set = deferredGenerator(report_DAV__principal_search_property_set)
Modified: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.resource.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.resource.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.resource.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,6 +1,6 @@
Index: twisted/web2/dav/resource.py
===================================================================
---- twisted/web2/dav/resource.py (revision 18065)
+--- twisted/web2/dav/resource.py (revision 18074)
+++ twisted/web2/dav/resource.py (working copy)
@@ -599,7 +599,7 @@
else:
Modified: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.static.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.static.patch 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.dav.static.patch 2006-09-11 16:00:00 UTC (rev 114)
@@ -1,113 +1,13 @@
Index: twisted/web2/dav/static.py
===================================================================
---- twisted/web2/dav/static.py (revision 17966)
+--- twisted/web2/dav/static.py (revision 18074)
+++ twisted/web2/dav/static.py (working copy)
-@@ -29,7 +29,11 @@
- __all__ = ["DAVFile"]
-
- from twisted.python import log
--from twisted.internet import reactor, defer
-+from twisted.internet.defer import deferredGenerator, waitForDeferred
-+from twisted.internet.defer import succeed
+@@ -34,6 +34,8 @@
+ from twisted.internet.defer import succeed, deferredGenerator, waitForDeferred
+ from twisted.web2.static import File
+ from twisted.web2 import dirlist
+from twisted.web2 import http
-+from twisted.web2 import dirlist
+from twisted.web2 import responsecode
- from twisted.web2.static import File
from twisted.web2.dav import davxml
from twisted.web2.dav.idav import IDAVResource
-@@ -34,7 +38,7 @@
- from twisted.web2.dav import davxml
- from twisted.web2.dav.idav import IDAVResource
from twisted.web2.dav.resource import DAVResource
--from twisted.web2.dav.util import bindMethods, joinURL
-+from twisted.web2.dav.util import bindMethods
-
- try:
- from twisted.web2.dav.xattrprops import xattrPropertyStore as DeadPropertyStore
-@@ -154,6 +158,86 @@
- def createSimilarFile(self, path):
- return self.__class__(path, defaultType=self.defaultType, indexNames=self.indexNames[:])
-
-+ def listChildrenWithPrivileges(self, privileges, request):
-+ """
-+ NB This method looks at the actual objects in the file system.
-+
-+ @return: a sequence of the names of all known children of this resource that have the
-+ associated privileges set.
-+ """
-+ children = self.listChildren()
-+
-+ result = []
-+
-+ # Do some optimisation of access control calculation by determining any inherited ACLs outside of
-+ # the child resource loop and supply those to the checkAccess on each child.
-+ filteredaces = waitForDeferred(self.inheritedACEsforChildren(request))
-+ yield filteredaces
-+ filteredaces = filteredaces.getResult()
-+
-+ # Check for disabled access
-+ if filteredaces is not None:
-+ for name in children:
-+ try:
-+ child = IDAVResource(self.getChild(name))
-+ except TypeError:
-+ child = None
-+
-+ if child is not None:
-+ # Check privileges of child - skip if access denied
-+ try:
-+ d = waitForDeferred(child.checkAccess(request, privileges, inheritedaces=filteredaces))
-+ yield d
-+ d.getResult()
-+ except:
-+ continue
-+ result.append(name)
-+
-+ yield result
-+
-+ listChildrenWithPrivileges = deferredGenerator(listChildrenWithPrivileges)
-+
-+ def render(self, req):
-+ """
-+ This is a direct copy of webs.static.render with the listChildren behavior replaced with
-+ findChildrenWithPrivileges to ensure that the current authenticated principal can only list
-+ directory contents that they have read permissions for.
-+ """
-+ if not self.fp.exists():
-+ yield responsecode.NOT_FOUND
-+ return
-+
-+ if self.fp.isdir():
-+ if req.uri[-1] != "/":
-+ # Redirect to include trailing '/' in URI
-+ yield http.RedirectResponse(req.unparseURL(path=req.path+'/'))
-+ return
-+ else:
-+ ifp = self.fp.childSearchPreauth(*self.indexNames)
-+ if ifp:
-+ # Render from the index file
-+ standin = self.createSimilarFile(ifp.path)
-+ else:
-+ children = waitForDeferred(self.listChildrenWithPrivileges((davxml.Read(),), req))
-+ yield children
-+ children = children.getResult()
-+
-+ # Render from a DirectoryLister
-+ standin = dirlist.DirectoryLister(
-+ self.fp.path,
-+ children,
-+ self.contentTypes,
-+ self.contentEncodings,
-+ self.defaultType
-+ )
-+ yield standin.render(req)
-+ return
-+
-+ # Do regular resource behavior from superclass
-+ yield super(DAVFile, self).render(req)
-+
-+ render = deferredGenerator(render)
-+
- #
- # Attach method handlers to DAVFile
- #
Modified: CalendarServer/branches/users/cdaboo/acl-merge/run
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/run 2006-09-08 16:17:45 UTC (rev 113)
+++ CalendarServer/branches/users/cdaboo/acl-merge/run 2006-09-11 16:00:00 UTC (rev 114)
@@ -411,7 +411,7 @@
svn_uri="svn://svn.twistedmatrix.com/svn/Twisted/branches/acl-1608-8";
fi;
- svn_get "Twisted" "${twisted}" "${svn_uri}" 18067;
+ svn_get "Twisted" "${twisted}" "${svn_uri}" 18078;
fi;
py_install "Twisted" "${twisted}";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20060911/5ac8e96c/attachment.html
More information about the calendarserver-changes
mailing list