[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - metaConfigure.py:1.1.2.12
Tres Seaver
tseaver@zope.com
Mon, 3 Dec 2001 22:43:58 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv22737
Modified Files:
Tag: Zope-3x-branch
metaConfigure.py
Log Message:
- Add configuration directive, '<security:defaultPolicy name="..." />',
to enable setting default security policy from config file.
=== Zope3/lib/python/Zope/App/Security/metaConfigure.py 1.1.2.11 => 1.1.2.12 ===
from Zope.Configuration import namespace
from Zope.Configuration.meta import register
+from Zope.Configuration.name import resolve
from protectClass import protectClass
from publicClass import publicClass
from PermissionRegistry import definePermission, defineRole
+from SecurityManager import setSecurityPolicy
+
+def setSecurityPolicy_directive( name ):
+ """
+ """
+ policy = resolve( name )
+ if callable( policy ):
+ policy = policy()
+ setSecurityPolicy( policy )
def metaConfigure():
register(namespace('security'), 'definePermission', definePermission)
register(namespace('security'), 'defineRole', defineRole)
register(namespace('security'), 'protectClass', protectClass)
register(namespace('security'), 'publicClass', publicClass)
+ register(namespace('security'), 'defaultPolicy',
+ setSecurityPolicy_directive)