[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - PrincipalRegistry.py:1.1.2.3 metaConfigure.py:1.1.2.14
Jim Fulton
jim@zope.com
Wed, 12 Dec 2001 18:01:29 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv3522
Modified Files:
Tag: Zope-3x-branch
PrincipalRegistry.py metaConfigure.py
Log Message:
Added a principal configuration directive.
=== Zope3/lib/python/Zope/App/Security/PrincipalRegistry.py 1.1.2.2 => 1.1.2.3 ===
self.__principalsByLogin = {}
- def definePrincipal(self, id, title, description, login, pw):
- p = Principal(id, title, description, login, pw)
+ def definePrincipal(self, principal, title, description='',
+ login='', password=''):
+ id=principal
if login in self.__principalsByLogin:
raise DuplicateLogin(login)
if id in self.__principalsById:
raise DuplicateId(id)
+ p = Principal(id, title, description, login, password)
+
self.__principalsByLogin[login]=p
self.__principalsById[id]=p
-
+ def clear(self):
+ self.__init__()
+
+globalRegistry=PrincipalRegistry()
class Principal:
=== Zope3/lib/python/Zope/App/Security/metaConfigure.py 1.1.2.13 => 1.1.2.14 ===
from RoleRegistry import defineRole
from SecurityManager import setSecurityPolicy
+from PrincipalRegistry import globalRegistry
def setSecurityPolicy_directive( name ):
"""
@@ -28,6 +29,7 @@
policy = policy()
setSecurityPolicy( policy )
+
def metaConfigure():
register(namespace('security'), 'definePermission', definePermission)
register(namespace('security'), 'defineRole', defineRole)
@@ -35,3 +37,7 @@
register(namespace('security'), 'publicClass', publicClass)
register(namespace('security'), 'defaultPolicy',
setSecurityPolicy_directive)
+
+ register(namespace('security'), 'principal',
+ globalRegistry.definePrincipal)
+