[CMF-checkins] CVS: CMF/CMFCore/tests/base - security.py:1.6

Yvo Schubbe cvs-admin at zope.org
Wed Nov 19 04:49:08 EST 2003


Update of /cvs-repository/CMF/CMFCore/tests/base
In directory cvs.zope.org:/tmp/cvs-serv13528/CMFCore/tests/base

Modified Files:
	security.py 
Log Message:
- reverted obsolete workaround in _checkPermission
- import and whitespace cleanup


=== CMF/CMFCore/tests/base/security.py 1.5 => 1.6 ===
--- CMF/CMFCore/tests/base/security.py:1.5	Mon Oct 20 05:40:00 2003
+++ CMF/CMFCore/tests/base/security.py	Wed Nov 19 04:48:37 2003
@@ -1,5 +1,9 @@
+from types import StringType, UnicodeType
+
+from AccessControl.PermissionRole import rolesForPermissionOn
 from Acquisition import Implicit
 
+
 class PermissiveSecurityPolicy:
     """
         Very permissive security policy for unit testing purposes.
@@ -18,10 +22,14 @@
                 , **kw):
         return 1
     
-    def checkPermission( self, permission, object, context) :
+    def checkPermission(self, permission, object, context):
         if permission == 'forbidden permission':
             return 0
-        return 1
+        roles = rolesForPermissionOn(permission, object)
+        if type(roles) in (StringType, UnicodeType):
+            roles=[roles]
+        return context.user.allowed(object, roles)
+
 
 class OmnipotentUser( Implicit ):
     """




More information about the CMF-checkins mailing list