[Zope3-checkins] CVS: Zope3/src/zope/products/securitypolicy - zopepolicy.py:1.3.2.2

Marius Gedminas marius at pov.lt
Mon Mar 8 14:29:21 EST 2004


Update of /cvs-repository/Zope3/src/zope/products/securitypolicy
In directory cvs.zope.org:/tmp/cvs-serv26336/src/zope/products/securitypolicy

Modified Files:
      Tag: mgedmin-events2-branch
	zopepolicy.py 
Log Message:
I've decided that the interaction on security proxies is just a cache, and
therefore security policies should cope with it being None and should use
getInteraction() in that case.  (This policy can become problematic if a
security proxy created in one interaction survives it.  However, if this
policy is changed, then storing interactions in security proxies makes
no sense.)

Also added a missing call to endInteraction in the functional test mechanism.
(I'm really starting to think that endInteraction should never throw) and
some debugging code in newInteraction that helps finding the place where
a "leaked" interaction was created.



=== Zope3/src/zope/products/securitypolicy/zopepolicy.py 1.3.2.1 => 1.3.2.2 ===
--- Zope3/src/zope/products/securitypolicy/zopepolicy.py:1.3.2.1	Mon Mar  8 13:43:43 2004
+++ Zope3/src/zope/products/securitypolicy/zopepolicy.py	Mon Mar  8 14:28:43 2004
@@ -20,6 +20,7 @@
 
 from zope.security.interfaces import ISecurityPolicy
 from zope.security.management import system_user
+from zope.security.management import getInteraction
 from zope.security.simpleinteraction import createInteraction \
                                             as _createInteraction
 
@@ -73,6 +74,8 @@
     createInteraction = staticmethod(_createInteraction)
 
     def checkPermission(self, permission, object, interaction):
+        if interaction is None: # interaction arg is just a cache here
+            interaction = getInteraction()
         # XXX We aren't really handling multiple principals yet
         assert len(interaction.principals) == 1 # XXX
         user = interaction.principals[0]




More information about the Zope3-Checkins mailing list