[Zope3-checkins] CVS: Zope3/src/zope/app/securitypolicy - metaconfigure.py:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Mar 5 13:38:36 EST 2004


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

Modified Files:
	metaconfigure.py 
Log Message:


Just create a role and register it with the utility service now.




=== Zope3/src/zope/app/securitypolicy/metaconfigure.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/securitypolicy/metaconfigure.py:1.1	Fri Feb 27 07:46:31 2004
+++ Zope3/src/zope/app/securitypolicy/metaconfigure.py	Fri Mar  5 13:38:35 2004
@@ -16,8 +16,10 @@
 $Id$
 """
 from zope.configuration.exceptions import ConfigurationError
+from zope.app.component.metaconfigure import utility
 
-from zope.app.securitypolicy.roleregistry import roleRegistry as role_reg
+from zope.app.securitypolicy.interfaces import IRole 
+from zope.app.securitypolicy.role import Role 
 from zope.app.securitypolicy.rolepermission \
      import rolePermissionManager as role_perm_mgr
 from zope.app.securitypolicy.principalpermission \
@@ -27,7 +29,7 @@
 
 
 def grant(_context, principal=None, role=None, permission=None):
-    if (  (principal is not None)
+    if ( (principal is not None)
         + (role is not None)
         + (permission is not None)
           ) != 2:
@@ -55,9 +57,8 @@
             callable = role_perm_mgr.grantPermissionToRole,
             args = (permission, role) )
 
+
 def defineRole(_context, id, title, description=''):
-    _context.action(
-            discriminator = ('defineRole', id),
-            callable = role_reg.defineRole,
-            args = (id, title, description) )
+    role = Role(id, title, description)
+    utility(_context, IRole, role, name=id)
 




More information about the Zope3-Checkins mailing list