Commit 430596e5 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Site_getAuthenticatedMemberPersonValue: Deprecate

And simplify.
parent a6e5d03d
"""Find and returns Person object for current logged in user. """Find and returns Person object for current logged in user.
Returns None if no corresponding person, for example when not using ERP5Security.ERP5UserManager. Returns None if no corresponding person, for example when not using ERP5Security.ERP5UserManager.
""" """
portal = context.getPortalObject() from Products.ERP5Type.Log import log
if user_name is None: if user_name is None:
return portal.portal_membership.getAuthenticatedMember().getUserValue() log('DEPRECATED: call context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()')
user_path_set = { return context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
x['path'] log('DEPRECATED: call context.Base_getUserValueByUserId(user_name)')
for x in portal.acl_users.searchUsers(exact_match=True, id=user_name) return context.Base_getUserValueByUserId(user_name)
if 'path' in x
}
if len(user_path_set) == 1:
user_path, = user_path_set
return portal.restrictedTraverse(user_path)
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