[CalendarServer-changes] [151] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Sep 18 19:22:41 PDT 2006


Revision: 151
Author:   wsanchez at apple.com
Date:     2006-09-18 19:22:37 -0700 (Mon, 18 Sep 2006)

Log Message:
-----------
Twisted r18205, various API cleanup.

Modified Paths:
--------------
    CalendarServer/trunk/run
    CalendarServer/trunk/twistedcaldav/itip.py
    CalendarServer/trunk/twistedcaldav/method/copymove.py
    CalendarServer/trunk/twistedcaldav/method/mkcalendar.py
    CalendarServer/trunk/twistedcaldav/method/post.py
    CalendarServer/trunk/twistedcaldav/method/report_calquery.py
    CalendarServer/trunk/twistedcaldav/method/report_common.py
    CalendarServer/trunk/twistedcaldav/method/report_multiget.py
    CalendarServer/trunk/twistedcaldav/method/schedule.py
    CalendarServer/trunk/twistedcaldav/method/schedule_common.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/static.py

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/run	2006-09-19 02:22:37 UTC (rev 151)
@@ -415,7 +415,7 @@
       ;;
   esac;
   svn_uri="${proto}://svn.twistedmatrix.com/svn/Twisted/branches/dav-acl-1608";
-  svn_get "Twisted" "${twisted}" "${svn_uri}" 18204;
+  svn_get "Twisted" "${twisted}" "${svn_uri}" 18205;
 fi;
 py_install "Twisted" "${twisted}";
  

Modified: CalendarServer/trunk/twistedcaldav/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/itip.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/itip.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -565,7 +565,7 @@
     inbox = inbox.getResult()
 
     try:
-        d = waitForDeferred(inbox.checkAccess(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(principal.principalURL()))))
+        d = waitForDeferred(inbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(principal.principalURL()))))
         yield d
         d.getResult()
     except:
@@ -600,7 +600,7 @@
     outbox = outbox.getResult()
 
     try:
-        d = waitForDeferred(outbox.checkAccess(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(principal.principalURL()))))
+        d = waitForDeferred(outbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(principal.principalURL()))))
         yield d
         d.getResult()
     except:

Modified: CalendarServer/trunk/twistedcaldav/method/copymove.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/copymove.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/copymove.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -58,12 +58,12 @@
     #
     # Check authentication and access controls
     #
-    x = waitForDeferred(self.securityCheck(request, (davxml.Read(),), recurse=True))
+    x = waitForDeferred(self.authorize(request, (davxml.Read(),), recurse=True))
     yield x
     x.getResult()
 
     if destination.exists():
-        x = waitForDeferred(destination.securityCheck(request, (davxml.WriteContent(), davxml.WriteProperties()), recurse=True))
+        x = waitForDeferred(destination.authorize(request, (davxml.WriteContent(), davxml.WriteProperties()), recurse=True))
         yield x
         x.getResult()
     else:
@@ -71,7 +71,7 @@
         yield destparent
         destparent = destparent.getResult()
  
-        x = waitForDeferred(destparent.securityCheck(request, (davxml.Bind(),)))
+        x = waitForDeferred(destparent.authorize(request, (davxml.Bind(),)))
         yield x
         x.getResult()
 
@@ -141,12 +141,12 @@
     yield parent
     parent = parent.getResult()
 
-    x = waitForDeferred(parent.securityCheck(request, (davxml.Unbind(),)))
+    x = waitForDeferred(parent.authorize(request, (davxml.Unbind(),)))
     yield x
     x.getResult()
 
     if destination.exists():
-        x = waitForDeferred(destination.securityCheck(request, (davxml.Bind(), davxml.Unbind()), recurse=True))
+        x = waitForDeferred(destination.authorize(request, (davxml.Bind(), davxml.Unbind()), recurse=True))
         yield x
         x.getResult()
     else:
@@ -154,7 +154,7 @@
         yield destparent
         destparent = destparent.getResult()
 
-        x = waitForDeferred(destparent.securityCheck(request, (davxml.Bind(),)))
+        x = waitForDeferred(destparent.authorize(request, (davxml.Bind(),)))
         yield x
         x.getResult()
 

Modified: CalendarServer/trunk/twistedcaldav/method/mkcalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/mkcalendar.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/mkcalendar.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -50,7 +50,7 @@
     yield parent
     parent = parent.getResult()
 
-    x = waitForDeferred(parent.securityCheck(request, (davxml.Bind(),)))
+    x = waitForDeferred(parent.authorize(request, (davxml.Bind(),)))
     yield x
     x.getResult()
 

Modified: CalendarServer/trunk/twistedcaldav/method/post.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/post.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/post.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -48,7 +48,7 @@
     yield parent
     parent = parent.getResult()
 
-    d = waitForDeferred(parent.securityCheck(request, (caldavxml.Schedule(),)))
+    d = waitForDeferred(parent.authorize(request, (caldavxml.Schedule(),)))
     yield d
     d.getResult()
         

Modified: CalendarServer/trunk/twistedcaldav/method/report_calquery.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_calquery.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/report_calquery.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -141,7 +141,7 @@
                 filter.settimezone(tz)
 
             # 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.
+            # the child resource loop and supply those to the checkPrivileges on each child.
             filteredaces = waitForDeferred(calresource.inheritedACEsforChildren(request))
             yield filteredaces
             filteredaces = filteredaces.getResult()
@@ -156,7 +156,7 @@
                     child = child.getResult()
 
                     try:
-                        d = waitForDeferred(child.checkAccess(request, (davxml.Read(),), inheritedaces=filteredaces))
+                        d = waitForDeferred(child.checkPrivileges(request, (davxml.Read(),), inherited_aces=filteredaces))
                         yield d
                         d.getResult()
                     except:

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -70,7 +70,7 @@
 
     # First check the privilege on this resource
     try:
-        d = waitForDeferred(resource.checkAccess(request, privileges))
+        d = waitForDeferred(resource.checkPrivileges(request, privileges))
         yield d
         d.getResult()
     except:
@@ -277,7 +277,7 @@
     
     # First check the privilege on this collection
     try:
-        d = waitForDeferred(calresource.checkAccess(request, (caldavxml.ReadFreeBusy(),)))
+        d = waitForDeferred(calresource.checkPrivileges(request, (caldavxml.ReadFreeBusy(),)))
         yield d
         d.getResult()
     except:
@@ -319,7 +319,7 @@
     tzinfo = filter.settimezone(tz)
 
     # 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.
+    # the child resource loop and supply those to the checkPrivileges on each child.
     filteredaces = waitForDeferred(calresource.inheritedACEsforChildren(request))
     yield filteredaces
     filteredaces = filteredaces.getResult()
@@ -338,7 +338,7 @@
         child = child.getResult()
 
         try:
-            d = waitForDeferred(child.checkAccess(request, (caldavxml.ReadFreeBusy(),), inheritedaces=filteredaces))
+            d = waitForDeferred(child.checkPrivileges(request, (caldavxml.ReadFreeBusy(),), inherited_aces=filteredaces))
             yield d
             d.getResult()
         except:

Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -102,7 +102,7 @@
         requestURIis = "calendar"
 
         # 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.
+        # the child resource loop and supply those to the checkPrivileges on each child.
         filteredaces = waitForDeferred(self.inheritedACEsforChildren(request))
         yield filteredaces
         filteredaces = filteredaces.getResult()
@@ -164,19 +164,19 @@
                 
                 # Check privileges on parent - must have at least DAV:read
                 try:
-                    d = waitForDeferred(parent.checkAccess(request, (davxml.Read(),)))
+                    d = waitForDeferred(parent.checkPrivileges(request, (davxml.Read(),)))
                     yield d
                     d.getResult()
                 except:
                     responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
                     continue
                 
-                # Cache the last parent's inherited aces for checkAccess optimization
+                # Cache the last parent's inherited aces for checkPrivileges optimization
                 if lastParent != parent:
                     lastParent = parent
             
                     # 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.
+                    # the child resource loop and supply those to the checkPrivileges on each child.
                     filteredaces = waitForDeferred(parent.inheritedACEsforChildren(request))
                     yield filteredaces
                     filteredaces = filteredaces.getResult()
@@ -198,14 +198,14 @@
                 child = self
         
                 # 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.
+                # the child resource loop and supply those to the checkPrivileges on each child.
                 filteredaces = waitForDeferred(parent.inheritedACEsforChildren(request))
                 yield filteredaces
                 filteredaces = filteredaces.getResult()
     
             # Check privileges - must have at least DAV:read
             try:
-                d = waitForDeferred(child.checkAccess(request, (davxml.Read(),), inheritedaces=filteredaces))
+                d = waitForDeferred(child.checkPrivileges(request, (davxml.Read(),), inherited_aces=filteredaces))
                 yield d
                 d.getResult()
             except:

Modified: CalendarServer/trunk/twistedcaldav/method/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/schedule.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/schedule.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -48,7 +48,7 @@
     yield parent
     parent = parent.getResult()
 
-    d = waitForDeferred(parent.securityCheck(request, (caldavxml.Schedule(),)))
+    d = waitForDeferred(parent.authorize(request, (caldavxml.Schedule(),)))
     yield d
     d.getResult()
         

Modified: CalendarServer/trunk/twistedcaldav/method/schedule_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/schedule_common.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/method/schedule_common.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -259,7 +259,7 @@
             # Check access controls
             #
             try:
-                d = waitForDeferred(inbox.checkAccess(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(oprincipal))))
+                d = waitForDeferred(inbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef.fromString(oprincipal))))
                 yield d
                 d.getResult()
             except:

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -219,32 +219,32 @@
         """
         assert depth in ("0", "1", "infinity"), "Invalid depth: %s" % (depth,)
 
-        def _checkAccessEb(failure):
+        def checkPrivilegesError(failure):
             from twisted.web2.dav.acl import AccessDeniedError
             failure.trap(AccessDeniedError)
             
-            reactor.callLater(0, _getChild)
+            reactor.callLater(0, getChild)
 
-        def _checkAccess(child):
+        def checkPrivileges(child):
             if privileges is None:
                 return child
    
-            ca = child.checkAccess(request, privileges)
+            ca = child.checkPrivileges(request, privileges)
             ca.addCallback(lambda ign: child)
             return ca
 
-        def _gotChild(child, childpath):
+        def gotChild(child, childpath):
             if child.isCalendarCollection():
                 callback(child, childpath)
             elif child.isCollection():
                 if depth == 'infinity': 
                     fc = child.findCalendarCollections(depth, request, callback, privileges)
-                    fc.addCallback(lambda x: reactor.callLater(0, _getChild))
+                    fc.addCallback(lambda x: reactor.callLater(0, getChild))
                     return fc
 
-            reactor.callLater(0, _getChild)
+            reactor.callLater(0, getChild)
 
-        def _getChild():
+        def getChild():
             try:
                 childname = children.pop()
             except IndexError:
@@ -252,8 +252,8 @@
             else:
                 childpath = joinURL(basepath, childname)
                 child = request.locateResource(childpath)
-                child.addCallback(_checkAccess)
-                child.addCallbacks(_gotChild, _checkAccessEb, (childpath,))
+                child.addCallback(checkPrivileges)
+                child.addCallbacks(gotChild, checkPrivilegesError, (childpath,))
                 child.addErrback(completionDeferred.errback)
 
         completionDeferred = Deferred()
@@ -261,7 +261,7 @@
         if depth != "0" and self.isCollection():
             basepath = request.urlForResource(self)
             children = self.listChildren()
-            _getChild()
+            getChild()
         else:
             completionDeferred.callback(None)
 

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2006-09-19 01:14:09 UTC (rev 150)
+++ CalendarServer/trunk/twistedcaldav/static.py	2006-09-19 02:22:37 UTC (rev 151)
@@ -145,7 +145,7 @@
             calendar.addProperty(iProperty("VERSION", "2.0"))
 
             # 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.
+            # the child resource loop and supply those to the checkPrivileges on each child.
             filteredaces = waitForDeferred(self.inheritedACEsforChildren(request))
             yield filteredaces
             filteredaces = filteredaces.getResult()
@@ -164,7 +164,7 @@
                 if child is not None:
                     # Check privileges of child - skip if access denied
                     try:
-                        d = waitForDeferred(child.checkAccess(request, (davxml.Read(),), inheritedaces=filteredaces))
+                        d = waitForDeferred(child.checkPrivileges(request, (davxml.Read(),), inherited_aces=filteredaces))
                         yield d
                         d.getResult()
                     except:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20060918/1e12da75/attachment.html


More information about the calendarserver-changes mailing list