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 ...@@ -36,7 +36,8 @@ from ERP5UserManager import SUPER_USER
class ConsistencyError(Exception): pass class ConsistencyError(Exception): pass
manage_addERP5GroupManagerForm = PageTemplateFile( 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 ): def addERP5GroupManager( dispatcher, id, title=None, REQUEST=None ):
""" Add a ERP5GroupManager to a Pluggable Auth Service. """ """ Add a ERP5GroupManager to a Pluggable Auth Service. """
...@@ -129,7 +130,8 @@ class ERP5GroupManager(BasePlugin): ...@@ -129,7 +130,8 @@ class ERP5GroupManager(BasePlugin):
security_definition_list: security_definition_list:
base_category_list = tuple(base_category_list) base_category_list = tuple(base_category_list)
method = getattr(self, method_name) 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: try:
security_category_list.extend( security_category_list.extend(
method(base_category_list, user_name, person_object, '') method(base_category_list, user_name, person_object, '')
...@@ -142,7 +144,8 @@ class ERP5GroupManager(BasePlugin): ...@@ -142,7 +144,8 @@ class ERP5GroupManager(BasePlugin):
error = sys.exc_info()) error = sys.exc_info())
# Get group names from category values # 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: if group_id_list_generator is not None:
for base_category_list, category_value_list in \ for base_category_list, category_value_list in \
security_category_dict.items(): security_category_dict.items():
...@@ -156,7 +159,8 @@ class ERP5GroupManager(BasePlugin): ...@@ -156,7 +159,8 @@ class ERP5GroupManager(BasePlugin):
raise raise
except: except:
LOG('ERP5GroupManager', WARNING, LOG('ERP5GroupManager', WARNING,
'could not get security groups from ERP5Type_asSecurityGroupIdList', 'could not get security groups from '
'ERP5Type_asSecurityGroupIdList',
error = sys.exc_info()) error = sys.exc_info())
else: else:
group_id_generator = getattr(self, 'ERP5Type_asSecurityGroupId') group_id_generator = getattr(self, 'ERP5Type_asSecurityGroupId')
...@@ -165,20 +169,25 @@ class ERP5GroupManager(BasePlugin): ...@@ -165,20 +169,25 @@ class ERP5GroupManager(BasePlugin):
for category_dict in category_value_list: for category_dict in category_value_list:
try: try:
security_group_list.append( 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: except ConflictError:
raise raise
except: except:
LOG('ERP5GroupManager', WARNING, LOG('ERP5GroupManager', WARNING,
'could not get security groups from ERP5Type_asSecurityGroupId', 'could not get security groups from '
'ERP5Type_asSecurityGroupId',
error = sys.exc_info()) error = sys.exc_info())
setSecurityManager(sm) setSecurityManager(sm)
return tuple(security_group_list) return tuple(security_group_list)
_getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal, id='ERP5GroupManager_getGroupsForPrincipal') _getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
return _getGroupsForPrincipal(user_name=principal.getId(), path=self.getPhysicalPath()) id='ERP5GroupManager_getGroupsForPrincipal')
return _getGroupsForPrincipal(
user_name=principal.getId(),
path=self.getPhysicalPath())
......
...@@ -20,12 +20,14 @@ from AccessControl import ClassSecurityInfo ...@@ -20,12 +20,14 @@ from AccessControl import ClassSecurityInfo
from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.PluggableAuthService.utils import classImplements 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 from ERP5UserManager import SUPER_USER
manage_addERP5RoleManagerForm = PageTemplateFile( 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 ): def addERP5RoleManager( dispatcher, id, title=None, REQUEST=None ):
""" Add a ERP5RoleManager to a Pluggable Auth Service. """ """ Add a ERP5RoleManager to a Pluggable Auth Service. """
......
...@@ -37,7 +37,8 @@ except ImportError: ...@@ -37,7 +37,8 @@ except ImportError:
SUPER_USER = '__erp5security-=__' SUPER_USER = '__erp5security-=__'
manage_addERP5UserManagerForm = PageTemplateFile( 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): def addERP5UserManager(dispatcher, id, title=None, REQUEST=None):
""" Add a ERP5UserManagern to a Pluggable Auth Service. """ """ Add a ERP5UserManagern to a Pluggable Auth Service. """
...@@ -102,14 +103,19 @@ class ERP5UserManager(BasePlugin): ...@@ -102,14 +103,19 @@ class ERP5UserManager(BasePlugin):
return None return None
_authenticateCredentials = CachingMethod(_authenticateCredentials, id='ERP5UserManager_authenticateCredentials') _authenticateCredentials = CachingMethod(_authenticateCredentials,
return _authenticateCredentials(login=credentials.get('login'), password=credentials.get('password'), path=self.getPhysicalPath()) id='ERP5UserManager_authenticateCredentials')
return _authenticateCredentials(
login=credentials.get('login'),
password=credentials.get('password'),
path=self.getPhysicalPath())
# #
# IUserEnumerationPlugin implementation # IUserEnumerationPlugin implementation
# #
security.declarePrivate( 'enumerateUsers' ) 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. """ See IUserEnumerationPlugin.
""" """
def _enumerateUsers(id_tuple, exact_match, path): def _enumerateUsers(id_tuple, exact_match, path):
...@@ -141,7 +147,8 @@ class ERP5UserManager(BasePlugin): ...@@ -141,7 +147,8 @@ class ERP5UserManager(BasePlugin):
return tuple(user_info) return tuple(user_info)
_enumerateUsers = CachingMethod(_enumerateUsers, id='ERP5UserManager_enumerateUsers') _enumerateUsers = CachingMethod(_enumerateUsers,
id='ERP5UserManager_enumerateUsers')
if id is None: if id is None:
id = login id = login
...@@ -149,7 +156,9 @@ class ERP5UserManager(BasePlugin): ...@@ -149,7 +156,9 @@ class ERP5UserManager(BasePlugin):
id = (id,) id = (id,)
if isinstance(id, list): if isinstance(id, list):
id = tuple(id) 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): def getUserByLogin(self, login):
""" """
...@@ -164,7 +173,8 @@ class ERP5UserManager(BasePlugin): ...@@ -164,7 +173,8 @@ class ERP5UserManager(BasePlugin):
if sm.getUser() != SUPER_USER: if sm.getUser() != SUPER_USER:
newSecurityManager(self, self.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) setSecurityManager(sm)
return [item.getObject() for item in result] 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