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,20 +147,26 @@ class ERP5UserManager(BasePlugin): ...@@ -147,20 +147,26 @@ 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): if id is None:
id = login
if isinstance(id, str):
id = (id,)
if isinstance(id, list):
id = tuple(id)
user_info = [] user_info = []
plugin_id = self.getId() plugin_id = self.getId()
id_list = [] id_list = []
for id in id_tuple: for user_id in id:
if SUPER_USER == id: if SUPER_USER == user_id:
info = { 'id' : SUPER_USER info = { 'id' : SUPER_USER
, 'login' : SUPER_USER , 'login' : SUPER_USER
, 'pluginid' : plugin_id , 'pluginid' : plugin_id
} }
user_info.append(info) user_info.append(info)
else: else:
id_list.append(id) id_list.append(user_id)
if id_list: if id_list:
for user in self.getUserByLogin(tuple(id_list), exact_match=exact_match): for user in self.getUserByLogin(tuple(id_list), exact_match=exact_match):
...@@ -173,20 +179,6 @@ class ERP5UserManager(BasePlugin): ...@@ -173,20 +179,6 @@ class ERP5UserManager(BasePlugin):
return tuple(user_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:
id = login
if isinstance(id, str):
id = (id,)
if isinstance(id, list):
id = tuple(id)
return _enumerateUsers(id_tuple=id,
exact_match=exact_match,
path=self.getPhysicalPath())
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