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
Paul Graydon
erp5
Commits
55f3beb9
Commit
55f3beb9
authored
Oct 12, 2022
by
Kazuhiko Shiozaki
Committed by
Arnaud Fontaine
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: rewrite Base_viewSecurity with py2/py3 compatible way of print().
parent
72eaa6b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurity.py
...tem/portal_skins/erp5_administration/Base_viewSecurity.py
+18
-18
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurityMappingAsUser.py
...ins/erp5_administration/Base_viewSecurityMappingAsUser.py
+5
-5
No files found.
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurity.py
View file @
55f3beb9
...
...
@@ -6,18 +6,18 @@ u = getSecurityManager().getUser()
user_value
=
u
.
getUserValue
()
if
user_value
is
None
:
print
'User ID:'
,
u
.
getId
(
)
print
(
'User ID: %s'
%
u
.
getId
()
)
else
:
print
'User ID:'
,
u
.
getId
(),
user_value
.
getPath
(
)
print
(
'User ID: %s %s'
%
(
u
.
getId
(),
user_value
.
getPath
())
)
login_value
=
u
.
getLoginValue
()
if
login_value
is
None
:
print
'Login:'
,
u
.
getUserName
(
)
print
(
'Login: %s'
%
u
.
getUserName
()
)
else
:
print
'Login:'
,
u
.
getUserName
(),
login_value
.
getPath
(
)
print
'Is owner:'
,
u
.
allowed
(
context
,(
'Owner'
,
))
print
'User roles:'
,
u
.
getRoles
(
)
print
'User roles in context:'
,
u
.
getRolesInContext
(
context
)
print
'Permissions:'
print
(
'Login: %s %s'
%
(
u
.
getUserName
(),
login_value
.
getPath
())
)
print
(
'Is owner: %s'
%
u
.
allowed
(
context
,(
'Owner'
,)
))
print
(
'User roles: %s'
%
u
.
getRoles
()
)
print
(
'User roles in context: %s'
%
u
.
getRolesInContext
(
context
)
)
print
(
'Permissions:'
)
for
permission
in
[
'Access contents information'
,
'Add portal content'
,
...
...
@@ -26,25 +26,25 @@ for permission in [
'View'
,
'Manage portal'
,
]:
print
" "
,
permission
,
u
.
has_permission
(
permission
,
context
)
print
(
" %s %s"
%
(
permission
,
u
.
has_permission
(
permission
,
context
))
)
print
print
(
''
)
try
:
print
"User groups:
\
n
"
,
pformat
(
sorted
(
u
.
getGroups
(
)))
print
(
"User groups:
\
n
%s"
%
pformat
(
sorted
(
u
.
getGroups
()
)))
except
AttributeError
:
print
'no getGroups'
print
(
'no getGroups'
)
print
print
'Local roles on document:
\
n
'
,
pformat
(
context
.
get_local_roles
(
))
print
(
''
)
print
(
'Local roles on document:
\
n
%s'
%
pformat
(
context
.
get_local_roles
()
))
print
'''
print
(
'''
----------------
Security mapping
----------------'''
----------------'''
)
if
u
.
getId
()
is
not
None
:
try
:
print
context
.
Base_viewSecurityMappingAsUser
(
u
.
getId
(
))
print
(
context
.
Base_viewSecurityMappingAsUser
(
u
.
getId
()
))
except
Unauthorized
:
print
"user doesn't have permission to security mapping in this context"
print
(
"user doesn't have permission to security mapping in this context"
)
return
printed
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurityMappingAsUser.py
View file @
55f3beb9
...
...
@@ -16,12 +16,12 @@ for method_id, base_category_list in getSecurityCategoryMapping():
security_category_dict
.
setdefault
(
tuple
(
base_category_list
),
[]).
extend
(
getattr
(
context
,
method_id
)(
base_category_list
,
login
,
context
,
''
))
except
Exception
:
# XXX: it is not possible to log message with traceback from python script
print
'It was not possible to invoke method %s with base_category_list %s'
%
(
method_id
,
base_category_list
)
print
(
'It was not possible to invoke method %s with base_category_list %s'
%
(
method_id
,
base_category_list
)
)
for
base_category_list
,
category_value_list
in
security_category_dict
.
items
():
print
'base_category_list:'
,
base_category_list
print
(
'base_category_list: %s'
%
(
base_category_list
,))
for
category_dict
in
category_value_list
:
print
'-> category_dict:'
,
category_dict
print
'-->'
,
group_id_list_generator
(
category_order
=
base_category_list
,
**
category_dict
)
print
(
'-> category_dict: %s'
%
category_dict
)
print
(
'--> %s'
%
group_id_list_generator
(
category_order
=
base_category_list
,
**
category_dict
)
)
return
printed
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