[Zope3-checkins] CVS: Zope3/src/zope/app/security - configure.zcml:1.15 permission.py:1.12

Jim Fulton jim at zope.com
Sun Apr 11 14:17:02 EDT 2004


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

Modified Files:
	configure.zcml permission.py 
Log Message:
Added a zcml definition of zope.Public. This was previously defined in
Python, in a way that depended on getting to the global utility
service via a global variable.

Moved the python code to zope.app.security.tests for use in tests.
This is now called by placelesssetup.


=== Zope3/src/zope/app/security/configure.zcml 1.14 => 1.15 ===
--- Zope3/src/zope/app/security/configure.zcml:1.14	Fri Mar 19 13:36:55 2004
+++ Zope3/src/zope/app/security/configure.zcml	Sun Apr 11 14:16:31 2004
@@ -3,6 +3,14 @@
     i18n_domain="zope"
     >
 
+  <permission
+      id="zope.Public"
+      title="[view-permission] Public"
+      description="Special permission indicating unconditional access
+Public resources are always accessable.
+"
+      />
+
   <include file="globalmodules.zcml" />
   <include file="_protections.zcml" />
   <include package=".browser" />


=== Zope3/src/zope/app/security/permission.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/security/permission.py:1.11	Mon Mar  8 07:06:01 2004
+++ Zope3/src/zope/app/security/permission.py	Sun Apr 11 14:16:31 2004
@@ -20,7 +20,7 @@
 from zope.schema.interfaces import ValidationError
 from zope.security.checker import CheckerPublic
 from zope.app import zapi
-from interfaces import IPermission, IPermissionField
+from zope.app.security.interfaces import IPermission, IPermissionField
 
 
 class Permission(object):
@@ -50,23 +50,3 @@
         super(PermissionField, self)._validate(value)
         if zapi.queryUtility(self.context, IPermission, name=value) is None:
             raise ValidationError("Unknown permission", value)
-
-
-def _addCheckerPublic():
-    """Add the CheckerPublic permission as 'zope.Public'"""
-    from zope.component.utility import utilityService
-    perm = Permission('zope.Public', 'Public',
-            """Special permission used for resources that are always public
-
-            The public permission is effectively an optimization, sine
-            it allows security computation to be bypassed.
-            """
-            )
-    utilityService.provideUtility(IPermission, perm, perm.id)
-
-_addCheckerPublic()
-
-# Register our cleanup with Testing.CleanUp to make writing unit tests simpler.
-from zope.testing.cleanup import addCleanUp
-addCleanUp(_addCheckerPublic)
-del addCleanUp




More information about the Zope3-Checkins mailing list