Commit 1cabf124 authored by Jérome Perrin's avatar Jérome Perrin

Fix lines too long



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8823 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c9fc00e9
......@@ -36,7 +36,8 @@ from ERP5UserManager import SUPER_USER
class ConsistencyError(Exception): pass
manage_addERP5GroupManagerForm = PageTemplateFile(
'www/ERP5Security_addERP5GroupManager', globals(), __name__='manage_addERP5GroupManagerForm' )
'www/ERP5Security_addERP5GroupManager', globals(),
__name__='manage_addERP5GroupManagerForm' )
def addERP5GroupManager( dispatcher, id, title=None, REQUEST=None ):
""" Add a ERP5GroupManager to a Pluggable Auth Service. """
......@@ -129,7 +130,8 @@ class ERP5GroupManager(BasePlugin):
security_definition_list:
base_category_list = tuple(base_category_list)
method = getattr(self, method_name)
security_category_list = security_category_dict.setdefault(base_category_list, [])
security_category_list = security_category_dict.setdefault(
base_category_list, [])
try:
security_category_list.extend(
method(base_category_list, user_name, person_object, '')
......@@ -142,7 +144,8 @@ class ERP5GroupManager(BasePlugin):
error = sys.exc_info())
# Get group names from category values
group_id_list_generator = getattr(self, 'ERP5Type_asSecurityGroupIdList', None)
group_id_list_generator = getattr(self,
'ERP5Type_asSecurityGroupIdList', None)
if group_id_list_generator is not None:
for base_category_list, category_value_list in \
security_category_dict.items():
......@@ -156,7 +159,8 @@ class ERP5GroupManager(BasePlugin):
raise
except:
LOG('ERP5GroupManager', WARNING,
'could not get security groups from ERP5Type_asSecurityGroupIdList',
'could not get security groups from '
'ERP5Type_asSecurityGroupIdList',
error = sys.exc_info())
else:
group_id_generator = getattr(self, 'ERP5Type_asSecurityGroupId')
......@@ -165,20 +169,25 @@ class ERP5GroupManager(BasePlugin):
for category_dict in category_value_list:
try:
security_group_list.append(
group_id_generator(category_order=base_category_list, **category_dict)
group_id_generator(category_order=base_category_list,
**category_dict)
)
except ConflictError:
raise
except:
LOG('ERP5GroupManager', WARNING,
'could not get security groups from ERP5Type_asSecurityGroupId',
'could not get security groups from '
'ERP5Type_asSecurityGroupId',
error = sys.exc_info())
setSecurityManager(sm)
return tuple(security_group_list)
_getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal, id='ERP5GroupManager_getGroupsForPrincipal')
return _getGroupsForPrincipal(user_name=principal.getId(), path=self.getPhysicalPath())
_getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
id='ERP5GroupManager_getGroupsForPrincipal')
return _getGroupsForPrincipal(
user_name=principal.getId(),
path=self.getPhysicalPath())
......
......@@ -20,12 +20,14 @@ from AccessControl import ClassSecurityInfo
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.PluggableAuthService.utils import classImplements
from Products.PluggableAuthService.interfaces.plugins import IRolesPlugin, IRoleEnumerationPlugin
from Products.PluggableAuthService.interfaces.plugins import IRolesPlugin,\
IRoleEnumerationPlugin
from ERP5UserManager import SUPER_USER
manage_addERP5RoleManagerForm = PageTemplateFile(
'www/ERP5Security_addERP5RoleManager', globals(), __name__='manage_addERP5RoleManagerForm' )
'www/ERP5Security_addERP5RoleManager', globals(),
__name__='manage_addERP5RoleManagerForm' )
def addERP5RoleManager( dispatcher, id, title=None, REQUEST=None ):
""" Add a ERP5RoleManager to a Pluggable Auth Service. """
......
......@@ -37,7 +37,8 @@ except ImportError:
SUPER_USER = '__erp5security-=__'
manage_addERP5UserManagerForm = PageTemplateFile(
'www/ERP5Security_addERP5UserManager', globals(), __name__='manage_addERP5UserManagerForm' )
'www/ERP5Security_addERP5UserManager', globals(),
__name__='manage_addERP5UserManagerForm' )
def addERP5UserManager(dispatcher, id, title=None, REQUEST=None):
""" Add a ERP5UserManagern to a Pluggable Auth Service. """
......@@ -102,14 +103,19 @@ class ERP5UserManager(BasePlugin):
return None
_authenticateCredentials = CachingMethod(_authenticateCredentials, id='ERP5UserManager_authenticateCredentials')
return _authenticateCredentials(login=credentials.get('login'), password=credentials.get('password'), path=self.getPhysicalPath())
_authenticateCredentials = CachingMethod(_authenticateCredentials,
id='ERP5UserManager_authenticateCredentials')
return _authenticateCredentials(
login=credentials.get('login'),
password=credentials.get('password'),
path=self.getPhysicalPath())
#
# IUserEnumerationPlugin implementation
#
security.declarePrivate( 'enumerateUsers' )
def enumerateUsers(self, id=None, login=None, exact_match=False, sort_by=None, max_results=None, **kw):
def enumerateUsers(self, id=None, login=None, exact_match=False,
sort_by=None, max_results=None, **kw):
""" See IUserEnumerationPlugin.
"""
def _enumerateUsers(id_tuple, exact_match, path):
......@@ -141,7 +147,8 @@ class ERP5UserManager(BasePlugin):
return tuple(user_info)
_enumerateUsers = CachingMethod(_enumerateUsers, id='ERP5UserManager_enumerateUsers')
_enumerateUsers = CachingMethod(_enumerateUsers,
id='ERP5UserManager_enumerateUsers')
if id is None:
id = login
......@@ -149,7 +156,9 @@ class ERP5UserManager(BasePlugin):
id = (id,)
if isinstance(id, list):
id = tuple(id)
return _enumerateUsers(id_tuple=id, exact_match=exact_match, path=self.getPhysicalPath())
return _enumerateUsers(id_tuple=id,
exact_match=exact_match,
path=self.getPhysicalPath())
def getUserByLogin(self, login):
"""
......@@ -164,7 +173,8 @@ class ERP5UserManager(BasePlugin):
if sm.getUser() != SUPER_USER:
newSecurityManager(self, self.getUser(SUPER_USER))
result = self.getPortalObject().portal_catalog(portal_type="Person", reference=login)
result = self.getPortalObject().portal_catalog(
portal_type="Person", reference=login)
setSecurityManager(sm)
return [item.getObject() for item in result]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment