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.
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:
return portal.portal_membership.getAuthenticatedMember().getUserValue()
user_path_set = {
x['path']
for x in portal.acl_users.searchUsers(exact_match=True, id=user_name)
if 'path' in x
}
if len(user_path_set) == 1:
user_path, = user_path_set
return portal.restrictedTraverse(user_path)
log('DEPRECATED: call context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()')
return context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
log('DEPRECATED: call context.Base_getUserValueByUserId(user_name)')
return context.Base_getUserValueByUserId(user_name)
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