Commit 39bfe1dc authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_base: user getUserValue() and getLoginValueList() in ERP5UserFactory.

parent 32aa838d
......@@ -3,9 +3,10 @@ Returns None if no corresponding person, for example when not using ERP5Security
"""
portal = context.getPortalObject()
if user_name is None:
user_name = portal.portal_membership.getAuthenticatedMember()
from Products.ERP5Security.ERP5UserManager import getUserByLogin
found_user_list = getUserByLogin(portal, str(user_name))
if len(found_user_list) == 1:
return found_user_list[0]
return portal.portal_membership.getAuthenticatedMember().getUser().getUserValue()
user_list = [x for x in portal.acl_users.searchUsers(
exact_match=True,
id=user_name,
) if 'path' in x]
if len(user_list) == 1:
return portal.restrictedTraverse(user_list[0]['path'])
......@@ -3,8 +3,7 @@ from Products.ERP5Type.Message import translateString
portal = context.getPortalObject()
user = getSecurityManager().getUser()
person = portal.restrictedTraverse(portal.acl_users.erp5_users.enumerateUsers(id=user.getId())[0]['path'])
for login in person.objectValues(portal_type='ERP5 Login'):
for login in user.getLoginValueList(portal_type='ERP5 Login'):
if login.getReference() == reference and login.getValidationState() == 'validated':
break
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