Changeset 5055 for main/waeup.sirp/trunk
- Timestamp:
- 11 Mar 2010, 13:30:48 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/authentication.py
r4920 r5055 2 2 """ 3 3 import grok 4 from zope.app.authentication.session import SessionCredentialsPlugin 5 from zope.app.authentication.interfaces import (ICredentialsPlugin, 6 IAuthenticatorPlugin, 7 IPrincipalInfo, 8 IPasswordManager) 4 import waeup.sirp.permissions 9 5 from zope.component import getUtility 6 try: 7 from zope.pluggableauth.plugins.session import SessionCredentialsPlugin 8 except ImportError: 9 # BBB 10 from zope.app.authentication.session import SessionCredentialsPlugin 11 try: 12 from zope.pluggableauth.interfaces import ( 13 ICredentialsPlugin, IAuthenticatorPlugin, IPrincipalInfo) 14 from zope.password.interfaces import IPasswordManager 15 except ImportError: 16 # BBB 17 from zope.app.authentication.interfaces import ( 18 ICredentialsPlugin, IAuthenticatorPlugin, IPrincipalInfo, 19 IPasswordManager) 10 20 from zope.securitypolicy.interfaces import IPrincipalRoleManager 11 21 from zope.securitypolicy.principalrole import principalRoleManager 12 22 from waeup.sirp.interfaces import IUserAccount 13 import waeup.sirp.permissions14 23 15 24 def setup_authentication(pau): … … 44 53 grok.implements(IUserAccount) 45 54 46 47 55 def __init__(self, name, password, title=None, description=None, 48 56 roles = []): … … 70 78 if x[0].startswith('waeup.')] 71 79 return roles 72 80 73 81 def setRoles(self, roles): 74 82 prm = self._getPrincipalRoleManager() 75 83 76 84 old_roles = self.getRoles() 77 85 for role in old_roles: … … 90 98 return IPrincipalRoleManager(portal) 91 99 return principalRoleManager 92 93 100 94 101 class UserAuthenticatorPlugin(grok.GlobalUtility): 95 102 grok.provides(IAuthenticatorPlugin) … … 138 145 return 139 146 usercontainer.addUser(name, password, title, description) 140 147 141 148 def getUserContainer(self): 142 149 site = grok.getSite()
Note: See TracChangeset for help on using the changeset viewer.