[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests - test_zopepolicy.py:1.15

Sidnei da Silva sidnei at x3ng.com.br
Mon Oct 6 15:29:50 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/security/tests
In directory cvs.zope.org:/tmp/cvs-serv422/tests

Modified Files:
	test_zopepolicy.py 
Log Message:
Honor 'Deny' setting on role, both placeful and placeless

=== Zope3/src/zope/app/security/tests/test_zopepolicy.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/security/tests/test_zopepolicy.py:1.14	Sun Sep 21 13:31:59 2003
+++ Zope3/src/zope/app/security/tests/test_zopepolicy.py	Mon Oct  6 15:29:49 2003
@@ -186,6 +186,18 @@
 
         self.__assertPermissions(self.jim, ['create', 'read', 'write'])
 
+    def testPlaylessPrincipalRole(self):
+        self.failIf(self.policy.checkPermission(
+            self.write, None, Context(self.jim)))
+        principalRoleManager.assignRoleToPrincipal(
+            self.manager, self.jim.getId())
+        self.failUnless(self.policy.checkPermission(
+            self.write, None, Context(self.jim)))
+        principalRoleManager.removeRoleFromPrincipal(
+            self.manager, self.jim.getId())
+        self.failIf(self.policy.checkPermission(
+            self.write, None, Context(self.jim)))
+
     def testPlayfulPrincipalRole(self):
         getService(None,Adapters).provideAdapter(
             ITest,
@@ -194,14 +206,17 @@
         ob1 = TestClass()
         ob2 = TestClass(); ob2.__parent__ = ob1
         ob3 = TestClass(); ob3.__parent__ = ob2
-        
+
         self.failIf(self.policy.checkPermission(
             self.write, ob3, Context(self.jim)))
         AnnotationPrincipalRoleManager(ob3).assignRoleToPrincipal(
             self.manager, self.jim.getId())
         self.failUnless(self.policy.checkPermission(
             self.write, ob3, Context(self.jim)))
-
+        AnnotationPrincipalRoleManager(ob3).removeRoleFromPrincipal(
+            self.manager, self.jim.getId())
+        self.failIf(self.policy.checkPermission(
+            self.write, ob3, Context(self.jim)))
 
     def testPlayfulRolePermissions(self):
 




More information about the Zope3-Checkins mailing list