Commit bbc09fc2 authored by Vincent Pelletier's avatar Vincent Pelletier

fixup! Use PAS API.

parent fe27a9c3
"""Returns the name of the owner of current document """Returns the name of the owner of current document
""" """
owner_id_list = [i[0] for i in context.get_local_roles() if 'Owner' in i[1]] from zExceptions import Unauthorized
if owner_id_list: # A single value is generally expecteted, do not bother optimising for other cases unless necessary.
found_user_path_set = {x['path'] for x in context.acl_users.searchUsers(id=tuple(owner_id_list), exact_match=True) if 'path' in x} owner_id = None
if found_user_path_set: for user_id, role_set in context.get_local_roles():
found_user_path, = found_user_path_set if 'Owner' in role_set:
return context.getPortalObject().restrictedTraverse(found_user_path).getTitle() owner_id = user_id
return owner_id_list[0] try:
user = context.Base_getUserValueByUserId(user_id)
if user is not None:
return user.getTitle()
except Unauthorized:
pass
return owner_id
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