[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Security - ZopeSecurityPolicy.py:1.8

Steve Alexander steve@cat-box.net
Tue, 17 Dec 2002 14:06:17 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv3076/lib/python/Zope/App/Security

Modified Files:
	ZopeSecurityPolicy.py 
Log Message:
fixed up formatting. changed the confusing double use of "object" to be
"object" and "place".


=== Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py:1.7	Fri Nov  8 12:14:19 2002
+++ Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py	Tue Dec 17 14:06:17 2002
@@ -46,10 +46,10 @@
 
 getPermissionsForPrincipal = \
                 principalPermissionManager.getPermissionsForPrincipal
-getPermissionsForRole      = rolePermissionManager.getPermissionsForRole
-getRolesForPrincipal       = principalRoleManager.getRolesForPrincipal
+getPermissionsForRole = rolePermissionManager.getPermissionsForRole
+getRolesForPrincipal = principalRoleManager.getRolesForPrincipal
 
-globalContext=object()
+globalContext = object()
 
 class ZopeSecurityPolicy:
 
@@ -78,8 +78,8 @@
                 clients allow full management.
         """
         
-        self._ownerous=ownerous
-        self._authenticated=authenticated
+        self._ownerous = ownerous
+        self._authenticated = authenticated
 
     def checkPermission(self, permission, object, context):
         # XXX We aren't really handling multiple principals yet
@@ -93,7 +93,6 @@
         
         role_permissions = {}
         remove = {}
-        orig = object
 
         # Look for placeless grants first.
 
@@ -159,12 +158,11 @@
                 # we've eliminated all the principals
                 return 1
 
-
         # Look for placeful grants
-        for object in ContainmentIterator(orig):
+        for place in ContainmentIterator(object):
 
             # Copy specific principal permissions
-            prinper = queryAdapter(object, IPrincipalPermissionMap)
+            prinper = queryAdapter(place, IPrincipalPermissionMap)
             if prinper is not None:
                 for principal in principals:
                     for principal_permission, setting in (
@@ -188,7 +186,7 @@
                     return 1
                 
             # Collect principal roles
-            prinrole = queryAdapter(object, IPrincipalRoleMap)
+            prinrole = queryAdapter(place, IPrincipalRoleMap)
             if prinrole is not None:
                 for principal in principals:
                     roles = principals[principal]
@@ -199,7 +197,7 @@
                             roles[role] = setting
 
             # Collect role permissions
-            roleper = queryAdapter(object, IRolePermissionMap)
+            roleper = queryAdapter(place, IRolePermissionMap)
             if roleper is not None:
                 for perm, role, setting in roleper.getRolesAndPermissions():
                     assert setting in (Allow, Deny)
@@ -238,7 +236,6 @@
     permissions = {}
     roles = {'Anonymous': Allow} # Everyone has anonymous
     role_permissions = {}
-    orig = object
 
     # Make two passes.
 
@@ -256,10 +253,10 @@
             roles[role] = setting
 
     # get placeful principal permissions and roles
-    for object in ContainmentIterator(orig):
+    for place in ContainmentIterator(object):
 
         # Copy specific principal permissions
-        prinper = queryAdapter(object, IPrincipalPermissionMap)
+        prinper = queryAdapter(place, IPrincipalPermissionMap)
         if prinper is not None:
             for permission, setting in prinper.getPermissionsForPrincipal(
                 principal):
@@ -267,7 +264,7 @@
                     permissions[permission] = setting
 
         # Collect principal roles
-        prinrole = queryAdapter(object, IPrincipalRoleMap)
+        prinrole = queryAdapter(place, IPrincipalRoleMap)
         if prinrole is not None:
             for role, setting in prinrole.getRolesForPrincipal(principal):
                 if role not in roles:
@@ -280,10 +277,10 @@
         if role in roles and perm not in permissions:
             permissions[perm] = setting
 
-    for object in ContainmentIterator(orig):
+    for place in ContainmentIterator(object):
 
         # Collect role permissions
-        roleper = queryAdapter(object, IRolePermissionMap)
+        roleper = queryAdapter(place, IRolePermissionMap)
         if roleper is not None:
             for perm, role, setting in roleper.getRolesAndPermissions():
                 if role in roles and perm not in permissions: