Commit 925886cc authored by Jérome Perrin's avatar Jérome Perrin

no need to cache enumerateUsers, because getUserByLogin is already cached


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27237 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent acffa000
...@@ -147,46 +147,38 @@ class ERP5UserManager(BasePlugin): ...@@ -147,46 +147,38 @@ class ERP5UserManager(BasePlugin):
sort_by=None, max_results=None, **kw): sort_by=None, max_results=None, **kw):
""" See IUserEnumerationPlugin. """ See IUserEnumerationPlugin.
""" """
def _enumerateUsers(id_tuple, exact_match, path):
user_info = []
plugin_id = self.getId()
id_list = []
for id in id_tuple:
if SUPER_USER == id:
info = { 'id' : SUPER_USER
, 'login' : SUPER_USER
, 'pluginid' : plugin_id
}
user_info.append(info)
else:
id_list.append(id)
if id_list:
for user in self.getUserByLogin(tuple(id_list), exact_match=exact_match):
info = { 'id' : user.getReference()
, 'login' : user.getReference()
, 'pluginid' : plugin_id
}
user_info.append(info)
return tuple(user_info)
# XXX is this cache usefull ???
_enumerateUsers = CachingMethod(_enumerateUsers,
id='ERP5UserManager_enumerateUsers',
cache_factory='erp5_content_short')
if id is None: if id is None:
id = login id = login
if isinstance(id, str): if isinstance(id, str):
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, user_info = []
path=self.getPhysicalPath()) plugin_id = self.getId()
id_list = []
for user_id in id:
if SUPER_USER == user_id:
info = { 'id' : SUPER_USER
, 'login' : SUPER_USER
, 'pluginid' : plugin_id
}
user_info.append(info)
else:
id_list.append(user_id)
if id_list:
for user in self.getUserByLogin(tuple(id_list), exact_match=exact_match):
info = { 'id' : user.getReference()
, 'login' : user.getReference()
, 'pluginid' : plugin_id
}
user_info.append(info)
return tuple(user_info)
def getUserByLogin(self, login, exact_match=True): def getUserByLogin(self, login, exact_match=True):
# Search the Catalog for login and return a list of person objects # Search the Catalog for login and return a list of person objects
......
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