[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - metaConfigure.py:1.1.2.23
Steve Alexander
steve@cat-box.net
Sat, 23 Feb 2002 09:35:17 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv2851/lib/python/Zope/App/Security
Modified Files:
Tag: Zope-3x-branch
metaConfigure.py
Log Message:
Changed metaConfigure.py files to use Action rather than messy data structures.
=== Zope3/lib/python/Zope/App/Security/metaConfigure.py 1.1.2.22 => 1.1.2.23 ===
as principal_perm_mgr
from PrincipalRoleManager import principalRoleManager as principal_role_mgr
+from Zope.Configuration.Action import Action
def defaultPolicy(name):
policy = resolve( name )
if callable( policy ):
policy = policy()
- return [('defaultPolicy', setSecurityPolicy, (policy,))]
+ return [
+ Action(
+ discriminator = 'defaultPolicy',
+ callable = setSecurityPolicy,
+ args = (policy,),
+ )
+ ]
def definePermission(permission_id, title, description=''):
- action = (('definePermission', permission_id),
- perm_reg.definePermission, (permission_id, title, description))
- return (action,)
+ return [
+ Action(
+ discriminator = ('definePermission', permission_id),
+ callable = perm_reg.definePermission,
+ args = (permission_id, title, description),
+ )
+ ]
def defineRole(role_id, title, description=''):
- action = (('defineRole', role_id),
- role_reg.defineRole, (role_id, title, description))
- return (action,)
+ return [
+ Action(
+ discriminator = ('defineRole', role_id),
+ callable = role_reg.defineRole,
+ args = (role_id, title, description),
+ )
+ ]
def principal(principal_id, title, login, password, description=''):
- return [(
- ('principal', principal_id),
- principalRegistry.definePrincipal,
- (principal_id, title, description, login, password)
- )]
+ return [
+ Action(
+ discriminator = ('principal', principal_id),
+ callable = principalRegistry.definePrincipal,
+ args = (principal_id, title, description, login, password),
+ )
+ ]
def defaultPrincipal(principal_id, title, description=''):
- return [(
- 'defaultPrincipal',
- principalRegistry.defineDefaultPrincipal,
- (principal_id, title, description)
- )]
+ return [
+ Action(
+ discriminator = 'defaultPrincipal',
+ callable = principalRegistry.defineDefaultPrincipal,
+ args = (principal_id, title, description),
+ )
+ ]
def grantPermissionToRole(permission_id, role_id):
- return [(
- ('grantPermissionToRole', permission_id, role_id),
- role_perm_mgr.grantPermissionToRole,
- (permission_id, role_id)
- )]
+ return [
+ Action(
+ discriminator = ('grantPermissionToRole', permission_id, role_id),
+ callable = role_perm_mgr.grantPermissionToRole,
+ args = (permission_id, role_id),
+ )
+ ]
def grantPermissionToPrincipal(permission_id, principal_id):
- return [(
- ('grantPermissionToPrincipal', permission_id, principal_id),
- principal_perm_mgr.grantPermissionToPrincipal,
- (permission_id, principal_id)
- )]
+ return [
+ Action(
+ discriminator = ('grantPermissionToPrincipal',
+ permission_id,
+ principal_id),
+ callable = principal_perm_mgr.grantPermissionToPrincipal,
+ args = (permission_id, principal_id),
+ )
+ ]
def assignRoleToPrincipal(role_id, principal_id):
- return [(
- ('assignRoleToPrincipal', role_id, principal_id),
- principal_role_mgr.assignRoleToPrincipal,
- (role_id, principal_id)
- )]
+ return [
+ Action(
+ discriminator = ('assignRoleToPrincipal', role_id, principal_id),
+ callable = principal_role_mgr.assignRoleToPrincipal,
+ args = (role_id, principal_id),
+ )
+ ]