[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/ CheckerPublic permission id should always success

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Jul 23 05:38:09 EDT 2004


Log message for revision 26697:
  CheckerPublic permission id should always success
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/tests/test_zopepolicy.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/zopepolicy.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/tests/test_zopepolicy.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/tests/test_zopepolicy.py	2004-07-23 08:20:41 UTC (rev 26696)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/tests/test_zopepolicy.py	2004-07-23 09:38:08 UTC (rev 26697)
@@ -171,6 +171,10 @@
         verifyObject(IInteraction, i2)
         self.assertEquals(list(i2.participations), [rq])
 
+    def testCheckerPublic(self):
+        from zope.security.checker import CheckerPublic
+        self.failUnless(self.interaction.checkPermission(CheckerPublic, None))
+
     def testGlobalCheckPermission(self):
         r = RequestStub(self.jim)
         self.interaction.add(r)

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/zopepolicy.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/zopepolicy.py	2004-07-23 08:20:41 UTC (rev 26696)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/securitypolicy/zopepolicy.py	2004-07-23 09:38:08 UTC (rev 26697)
@@ -15,6 +15,7 @@
 
 $Id$
 """
+from zope.security.checker import CheckerPublic
 from zope.security.management import system_user
 import zope.security.simplepolicies
 from zope.security.interfaces import ISecurityPolicy
@@ -40,6 +41,8 @@
     zope.interface.classProvides(ISecurityPolicy)
 
     def checkPermission(self, permission, object):
+        if permission is CheckerPublic:
+            return True
         # XXX We aren't really handling multiple principals yet
         assert len(self.participations) == 1 # XXX
         user = self.participations[0].principal



More information about the Zope3-Checkins mailing list