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

Steve Alexander steve@cat-box.net
Tue, 4 Jun 2002 08:32:33 -0400


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

Modified Files:
      Tag: Zope3InWonderland-branch
	AnnotationPrincipalPermissionManager.py 
	AnnotationRolePermissionManager.py 
Log Message:
removal of extraneous whitespace in __init__.py

Fix infinite loop my making security management components unwrap
their context under some cicrcumstances. This may need to be revisited
later.


=== Zope3/lib/python/Zope/App/Security/AnnotationPrincipalPermissionManager.py 1.1.2.2 => 1.1.2.2.2.1 ===
         """ Get the principal permission map stored in the context, optionally
             creating one if necessary """
-        annotations = getAdapter(self._context, IAnnotations)
+        # need to remove security proxies here, otherwise we enter
+        # an infinite loop, becuase checking security depends on
+        # getting PrincipalPermissions.
+        from Zope.Proxy.ProxyIntrospection import removeAllProxies
+        context = removeAllProxies(self._context)
+        annotations = getAdapter(context, IAnnotations)
         try:
             return annotations[annotation_key]
         except KeyError:


=== Zope3/lib/python/Zope/App/Security/AnnotationRolePermissionManager.py 1.1.2.2 => 1.1.2.2.2.1 ===
         """Get the role permission map stored in the context, optionally
            creating one if necessary"""
-        annotations = getAdapter(self._context, IAnnotations)
+        # need to remove security proxies here, otherwise we enter
+        # an infinite loop, becuase checking security depends on
+        # getting RolePermissions.
+        from Zope.Proxy.ProxyIntrospection import removeAllProxies
+        context = removeAllProxies(self._context)
+        annotations = getAdapter(context, IAnnotations)
         try:
             return annotations[annotation_key]
         except KeyError: