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
Nikola Balog
erp5
Commits
acc0a305
Commit
acc0a305
authored
Oct 12, 2022
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Feb 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: rewrite Base_viewSecurity with py2/py3 compatible way of print().
parent
142e0854
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 @
acc0a305
...
@@ -6,18 +6,18 @@ u = getSecurityManager().getUser()
...
@@ -6,18 +6,18 @@ u = getSecurityManager().getUser()
user_value
=
u
.
getUserValue
()
user_value
=
u
.
getUserValue
()
if
user_value
is
None
:
if
user_value
is
None
:
print
'User ID:'
,
u
.
getId
(
)
print
(
'User ID: %s'
%
u
.
getId
()
)
else
:
else
:
print
'User ID:'
,
u
.
getId
(),
user_value
.
getPath
(
)
print
(
'User ID: %s %s'
%
(
u
.
getId
(),
user_value
.
getPath
())
)
login_value
=
u
.
getLoginValue
()
login_value
=
u
.
getLoginValue
()
if
login_value
is
None
:
if
login_value
is
None
:
print
'Login:'
,
u
.
getUserName
(
)
print
(
'Login: %s'
%
u
.
getUserName
()
)
else
:
else
:
print
'Login:'
,
u
.
getUserName
(),
login_value
.
getPath
(
)
print
(
'Login: %s %s'
%
(
u
.
getUserName
(),
login_value
.
getPath
())
)
print
'Is owner:'
,
u
.
allowed
(
context
,(
'Owner'
,
))
print
(
'Is owner: %s'
%
u
.
allowed
(
context
,(
'Owner'
,)
))
print
'User roles:'
,
u
.
getRoles
(
)
print
(
'User roles: %s'
%
u
.
getRoles
()
)
print
'User roles in context:'
,
u
.
getRolesInContext
(
context
)
print
(
'User roles in context: %s'
%
u
.
getRolesInContext
(
context
)
)
print
'Permissions:'
print
(
'Permissions:'
)
for
permission
in
[
for
permission
in
[
'Access contents information'
,
'Access contents information'
,
'Add portal content'
,
'Add portal content'
,
...
@@ -26,25 +26,25 @@ for permission in [
...
@@ -26,25 +26,25 @@ for permission in [
'View'
,
'View'
,
'Manage portal'
,
'Manage portal'
,
]:
]:
print
" "
,
permission
,
u
.
has_permission
(
permission
,
context
)
print
(
" %s %s"
%
(
permission
,
u
.
has_permission
(
permission
,
context
))
)
print
print
(
''
)
try
:
try
:
print
"User groups:
\
n
"
,
pformat
(
sorted
(
u
.
getGroups
(
)))
print
(
"User groups:
\
n
%s"
%
pformat
(
sorted
(
u
.
getGroups
()
)))
except
AttributeError
:
except
AttributeError
:
print
'no getGroups'
print
(
'no getGroups'
)
print
print
(
''
)
print
'Local roles on document:
\
n
'
,
pformat
(
context
.
get_local_roles
(
))
print
(
'Local roles on document:
\
n
%s'
%
pformat
(
context
.
get_local_roles
()
))
print
'''
print
(
'''
----------------
----------------
Security mapping
Security mapping
----------------'''
----------------'''
)
if
u
.
getId
()
is
not
None
:
if
u
.
getId
()
is
not
None
:
try
:
try
:
print
context
.
Base_viewSecurityMappingAsUser
(
u
.
getId
(
))
print
(
context
.
Base_viewSecurityMappingAsUser
(
u
.
getId
()
))
except
Unauthorized
:
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
return
printed
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Base_viewSecurityMappingAsUser.py
View file @
acc0a305
...
@@ -16,12 +16,12 @@ for method_id, base_category_list in getSecurityCategoryMapping():
...
@@ -16,12 +16,12 @@ for method_id, base_category_list in getSecurityCategoryMapping():
security_category_dict
.
setdefault
(
tuple
(
base_category_list
),
[]).
extend
(
security_category_dict
.
setdefault
(
tuple
(
base_category_list
),
[]).
extend
(
getattr
(
context
,
method_id
)(
base_category_list
,
login
,
context
,
''
))
getattr
(
context
,
method_id
)(
base_category_list
,
login
,
context
,
''
))
except
Exception
:
# XXX: it is not possible to log message with traceback from python script
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
():
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
:
for
category_dict
in
category_value_list
:
print
'-> category_dict:'
,
category_dict
print
(
'-> category_dict: %s'
%
category_dict
)
print
'-->'
,
group_id_list_generator
(
category_order
=
base_category_list
,
print
(
'--> %s'
%
group_id_list_generator
(
category_order
=
base_category_list
,
**
category_dict
)
**
category_dict
)
)
return
printed
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