[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - AnnotationPrincipalPermissionManager.py:1.1.2.2 AnnotationPrincipalRoleManager.py:1.1.2.2 AnnotationRolePermissionManager.py:1.1.2.2

Steve Alexander steve@cat-box.net
Tue, 28 May 2002 10:06:53 -0400


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

Modified Files:
      Tag: Zope-3x-branch
	AnnotationPrincipalPermissionManager.py 
	AnnotationPrincipalRoleManager.py 
	AnnotationRolePermissionManager.py 
Log Message:
made attribute annotations wrap what they return in the object that
holds the annotation.


=== Zope3/lib/python/Zope/App/Security/AnnotationPrincipalPermissionManager.py 1.1.2.1 => 1.1.2.2 ===
 from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
 from Zope.App.Security.Settings import Allow, Deny, Unset
-from Zope.Proxy.ProxyIntrospection import removeAllProxies
 
 annotation_key = 'Zope.App.Security.AnnotationPrincipalPermissionManager'
 
@@ -29,7 +28,7 @@
     __implements__ = IPrincipalPermissionManager
 
     def __init__(self, context):
-        self._context = removeAllProxies(context)
+        self._context = context
 
     def grantPermissionToPrincipal(self, permission_id, principal_id):
         ''' See the interface IPrincipalPermissionManager '''


=== Zope3/lib/python/Zope/App/Security/AnnotationPrincipalRoleManager.py 1.1.2.1 => 1.1.2.2 ===
 from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
 from Zope.App.Security.Settings import Assign, Remove, Unset
-from Zope.Proxy.ProxyIntrospection import removeAllProxies
 
 annotation_key = 'Zope.App.Security.AnnotationPrincipalRoleManager'
 
@@ -29,7 +28,7 @@
     __implements__ = IPrincipalRoleManager
 
     def __init__(self, context):
-        self._context = removeAllProxies(context)
+        self._context = context
 
     def assignRoleToPrincipal(self, role_id, principal_id):
         ''' See the interface IPrincipalRoleManager '''


=== Zope3/lib/python/Zope/App/Security/AnnotationRolePermissionManager.py 1.1.2.1 => 1.1.2.2 ===
 from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
 from Zope.App.Security.Settings import Allow, Deny, Unset
-from Zope.Proxy.ProxyIntrospection import removeAllProxies
-
 
 annotation_key = 'Zope.App.Security.AnnotationRolePermissionManager'
 
-class  AnnotationRolePermissionManager:
+class AnnotationRolePermissionManager:
     """
-    provide adaptor that manages role permission data in an object attribute
+    provide adapter that manages role permission data in an object attribute
     """
 
     __implements__ = IRolePermissionManager
 
     def __init__(self, context):
-        self._context = removeAllProxies(context)
+        self._context = context
 
     def grantPermissionToRole(self, permission_id, role_id):
         ''' See the interface IRolePermissionManager '''
         rp = self._getRolePermissions(create=1)
-        rp.addCell( permission_id, role_id, Allow )
+        rp.addCell(permission_id, role_id, Allow)
+        # probably not needed, as annotations should manage
+        # their own persistence
         #self._context._p_changed = 1
 
     def denyPermissionToRole(self, permission_id, role_id):
         ''' See the interface IRolePermissionManager '''
         rp = self._getRolePermissions(create=1)
-        rp.addCell( permission_id, role_id, Deny )
+        rp.addCell(permission_id, role_id, Deny)
+        # probably not needed, as annotations should manage
+        # their own persistence
         #self._context._p_changed = 1
 
     def unsetPermissionFromRole(self, permission_id, role_id):
@@ -54,6 +56,8 @@
         # Only unset if there is a security map, otherwise, we're done
         if rp:
             rp.delCell(permission_id, role_id)
+            # probably not needed, as annotations should manage
+            # their own persistence
             #self._context._p_changed = 1
 
     def getRolesForPermission(self, permission_id):
@@ -89,8 +93,8 @@
             return Unset
 
     def _getRolePermissions(self, create=0):
-        """ Get the role permission map stored in the context, optionally
-            creating one if necessary """
+        """Get the role permission map stored in the context, optionally
+           creating one if necessary"""
         annotations = getAdapter(self._context, IAnnotations)
         try:
             return annotations[annotation_key]