Commit 5570c555 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! [by Vincent] Get rid of all module-global callables. Use PAS API...

fixup! [by Vincent] Get rid of all module-global callables. Use PAS API instead. Use all non-PAS API public methods. Use PAS API instead. Implement IAuthenticationPlugin API better, so PAS API becomes usable for ERP5-based authentication.
parent 403ad307
...@@ -142,8 +142,9 @@ class ERP5UserManager(BasePlugin): ...@@ -142,8 +142,9 @@ class ERP5UserManager(BasePlugin):
).dictionaries() ).dictionaries()
searchLogin = lambda **kw: unrestrictedSearchResults( searchLogin = lambda **kw: unrestrictedSearchResults(
select_list=('parent_uid', 'reference'), select_list=('parent_uid', 'reference'),
portal_type=login_portal_type, portal_type=login_portal_type or [],
validation_state='validated', validation_state='validated',
**kw
).dictionaries() ).dictionaries()
if login is None: if login is None:
# Only search by id if login is not given. Same logic as in # Only search by id if login is not given. Same logic as in
...@@ -177,7 +178,7 @@ class ERP5UserManager(BasePlugin): ...@@ -177,7 +178,7 @@ class ERP5UserManager(BasePlugin):
login_dict = {} login_dict = {}
if user_list: if user_list:
for login in searchLogin(parent_uid=[x['uid'] for x in user_list]): for login in searchLogin(parent_uid=[x['uid'] for x in user_list]):
login_dict.setdefault(login.parent_uid).append(login) login_dict.setdefault(login['parent_uid'], []).append(login)
if has_super_user: if has_super_user:
user_list.append({'uid': None, 'reference': SUPER_USER}) user_list.append({'uid': None, 'reference': SUPER_USER})
else: else:
...@@ -193,11 +194,11 @@ class ERP5UserManager(BasePlugin): ...@@ -193,11 +194,11 @@ class ERP5UserManager(BasePlugin):
reference={ reference={
'query': login, 'query': login,
'key': 'ExactMatch' if exact_match else 'Keyword', 'key': 'ExactMatch' if exact_match else 'Keyword',
} },
limit=max_results, limit=max_results,
): ):
if requested(login['refernce']): if requested(login['reference']):
login_dict.setdefault(login['parent_uid']).append(x) login_dict.setdefault(login['parent_uid'], []).append(login)
if login_dict: if login_dict:
user_list = searchUser(uid=list(login_dict)) user_list = searchUser(uid=list(login_dict))
else: else:
......
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