[CalendarServer-changes] [2271] CalendarServer/branches/users/cdaboo/better-proxy-db-2269/ lib-patches/Twisted/twisted.web2.dav.resource.patch

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 1 09:28:14 PDT 2008


Revision: 2271
          http://trac.macosforge.org/projects/calendarserver/changeset/2271
Author:   cdaboo at apple.com
Date:     2008-04-01 09:28:13 -0700 (Tue, 01 Apr 2008)

Log Message:
-----------
matchPrincipal is a deferredGenerator.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/better-proxy-db-2269/lib-patches/Twisted/twisted.web2.dav.resource.patch

Modified: CalendarServer/branches/users/cdaboo/better-proxy-db-2269/lib-patches/Twisted/twisted.web2.dav.resource.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/better-proxy-db-2269/lib-patches/Twisted/twisted.web2.dav.resource.patch	2008-04-01 14:27:59 UTC (rev 2270)
+++ CalendarServer/branches/users/cdaboo/better-proxy-db-2269/lib-patches/Twisted/twisted.web2.dav.resource.patch	2008-04-01 16:28:13 UTC (rev 2271)
@@ -371,7 +371,7 @@
                                  aces.append(davxml.ACE(*children))
              else:
                  aces.extend(inherited_aces)
-@@ -1128,7 +1198,7 @@
+@@ -1128,14 +1198,18 @@
                  # Adjust ACE for inherit on this resource
                  children = list(ace.children)
                  children.remove(TwistedACLInheritable())
@@ -380,7 +380,19 @@
                  aces.append(davxml.ACE(*children))
                  
          # Filter out those that do not have a principal match with the current principal
-@@ -1152,49 +1222,69 @@
+         principal = self.currentPrincipal(request)
+         filteredaces = []
+         for ace in aces:
+-            if self.matchPrincipal(principal, ace.principal, request):
++            match = waitForDeferred(self.matchPrincipal(principal, ace.principal, request))
++            yield match
++            match = match.getResult()
++
++            if match:
+                 if ace.invert:
+                     continue
+             else:
+@@ -1152,49 +1226,69 @@
  
          This implementation returns an empty set.
          """
@@ -478,7 +490,7 @@
      def samePrincipal(self, principal1, principal2):
          """
          Check whether the two prinicpals are exactly the same in terms of
-@@ -1219,7 +1309,6 @@
+@@ -1219,7 +1313,6 @@
              return False
                  
      def matchPrincipal(self, principal1, principal2, request):
@@ -486,7 +498,7 @@
          """
          Check whether the principal1 is a principal in the set defined by
          principal2.
-@@ -1244,6 +1333,9 @@
+@@ -1244,6 +1337,9 @@
              if isinstance(principal1, davxml.Unauthenticated):
                  yield False
                  return
@@ -496,7 +508,7 @@
              else:
                  yield True
                  return
-@@ -1271,7 +1363,6 @@
+@@ -1271,7 +1367,6 @@
  
          assert principal2 is not None, "principal2 is None"
  
@@ -504,7 +516,7 @@
          # Compare two HRefs and do group membership test as well
          if principal1 == principal2:
              yield True
-@@ -1302,9 +1393,9 @@
+@@ -1302,9 +1397,9 @@
          def testGroup(group):
              # Get principal resource for principal2
              if group and isinstance(group, DAVPrincipalResource):
@@ -517,7 +529,7 @@
                  
              return False
  
-@@ -1351,11 +1442,16 @@
+@@ -1351,11 +1446,16 @@
          @return C{True} if C{href_principal} is valid, C{False} otherwise.
  
          This implementation tests for a href element that corresponds to
@@ -537,7 +549,7 @@
          return d
  
      def resolvePrincipal(self, principal, request):
-@@ -1432,7 +1528,7 @@
+@@ -1432,7 +1532,7 @@
                  log.err("DAV:self ACE is set on non-principal resource %r" % (self,))
                  yield None
                  return
@@ -546,7 +558,7 @@
  
          if isinstance(principal, davxml.HRef):
              yield principal
-@@ -1517,6 +1613,270 @@
+@@ -1517,6 +1617,270 @@
          return None
  
      ##
@@ -817,7 +829,7 @@
      # HTTP
      ##
  
-@@ -1567,7 +1927,7 @@
+@@ -1567,7 +1931,7 @@
      def findChildren(self, depth, request, callback, privileges=None, inherited_aces=None):
          return succeed(None)
  
@@ -826,7 +838,7 @@
      """
      Resource representing a WebDAV principal.  (RFC 3744, section 2)
      """
-@@ -1577,7 +1937,7 @@
+@@ -1577,7 +1941,7 @@
      # WebDAV
      ##
  
@@ -835,7 +847,7 @@
          (dav_namespace, "alternate-URI-set"),
          (dav_namespace, "principal-URL"    ),
          (dav_namespace, "group-member-set" ),
-@@ -1585,14 +1945,11 @@
+@@ -1585,14 +1949,11 @@
      )
  
      def davComplianceClasses(self):
@@ -851,7 +863,7 @@
      def readProperty(self, property, request):
          def defer():
              if type(property) is tuple:
-@@ -1610,10 +1967,10 @@
+@@ -1610,10 +1971,10 @@
                      return davxml.PrincipalURL(davxml.HRef(self.principalURL()))
  
                  if name == "group-member-set":
@@ -864,7 +876,7 @@
  
                  if name == "resourcetype":
                      if self.isCollection():
-@@ -1677,8 +2034,27 @@
+@@ -1677,8 +2038,27 @@
          if self.principalURL() == uri:
              return True
          else:
@@ -893,7 +905,7 @@
  class AccessDeniedError(Exception):
      def __init__(self, errors):
          """ 
-@@ -1718,6 +2094,37 @@
+@@ -1718,6 +2098,37 @@
  davxml.registerElement(TwistedACLInheritable)
  davxml.ACE.allowed_children[(twisted_dav_namespace, "inheritable")] = (0, 1)
  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080401/0c8ea3d2/attachment-0001.html


More information about the calendarserver-changes mailing list