Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexander Emmerich
erp5
Commits
bbc09fc2
Commit
bbc09fc2
authored
Dec 20, 2016
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Use PAS API.
parent
fe27a9c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getOwnerTitle.py
...TemplateItem/portal_skins/erp5_core/Base_getOwnerTitle.py
+13
-7
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getOwnerTitle.py
View file @
bbc09fc2
"""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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment