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
"""
owner_id_list = [i[0] for i in context.get_local_roles() if 'Owner' in i[1]]
if owner_id_list:
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}
if found_user_path_set:
found_user_path, = found_user_path_set
return context.getPortalObject().restrictedTraverse(found_user_path).getTitle()
return owner_id_list[0]
from zExceptions import Unauthorized
# A single value is generally expecteted, do not bother optimising for other cases unless necessary.
owner_id = None
for user_id, role_set in context.get_local_roles():
if 'Owner' in role_set:
owner_id = user_id
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