Changeset 5055 for main/waeup.sirp/trunk


Ignore:
Timestamp:
11 Mar 2010, 13:30:48 (15 years ago)
Author:
uli
Message:

BBB imports.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/authentication.py

    r4920 r5055  
    22"""
    33import grok
    4 from zope.app.authentication.session import SessionCredentialsPlugin
    5 from zope.app.authentication.interfaces import (ICredentialsPlugin,
    6                                                 IAuthenticatorPlugin,
    7                                                 IPrincipalInfo,
    8                                                 IPasswordManager)
     4import waeup.sirp.permissions
    95from zope.component import getUtility
     6try:
     7    from zope.pluggableauth.plugins.session import SessionCredentialsPlugin
     8except ImportError:
     9    # BBB
     10    from zope.app.authentication.session import SessionCredentialsPlugin
     11try:
     12    from zope.pluggableauth.interfaces import (
     13        ICredentialsPlugin, IAuthenticatorPlugin, IPrincipalInfo)
     14    from zope.password.interfaces import IPasswordManager
     15except ImportError:
     16    # BBB
     17    from zope.app.authentication.interfaces import (
     18        ICredentialsPlugin, IAuthenticatorPlugin, IPrincipalInfo,
     19        IPasswordManager)
    1020from zope.securitypolicy.interfaces import IPrincipalRoleManager
    1121from zope.securitypolicy.principalrole import principalRoleManager
    1222from waeup.sirp.interfaces import IUserAccount
    13 import waeup.sirp.permissions
    1423
    1524def setup_authentication(pau):
     
    4453    grok.implements(IUserAccount)
    4554
    46 
    4755    def __init__(self, name, password, title=None, description=None,
    4856                 roles = []):
     
    7078                 if x[0].startswith('waeup.')]
    7179        return roles
    72    
     80
    7381    def setRoles(self, roles):
    7482        prm = self._getPrincipalRoleManager()
    75        
     83
    7684        old_roles = self.getRoles()
    7785        for role in old_roles:
     
    9098            return IPrincipalRoleManager(portal)
    9199        return principalRoleManager
    92        
    93    
     100
    94101class UserAuthenticatorPlugin(grok.GlobalUtility):
    95102    grok.provides(IAuthenticatorPlugin)
     
    138145            return
    139146        usercontainer.addUser(name, password, title, description)
    140        
     147
    141148    def getUserContainer(self):
    142149        site = grok.getSite()
Note: See TracChangeset for help on using the changeset viewer.