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
1
Issues
1
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
Roque
erp5
Commits
8496736e
Commit
8496736e
authored
Jul 11, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix propery indexation of local roles.
Adjust tests as local roles structure changed.
parent
f1ad9aec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+9
-9
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+1
-1
No files found.
product/ERP5Catalog/CatalogTool.py
View file @
8496736e
...
@@ -150,15 +150,15 @@ class IndexableObjectWrapper(object):
...
@@ -150,15 +150,15 @@ class IndexableObjectWrapper(object):
# If not, continue to index it in roles_and_users table.
# If not, continue to index it in roles_and_users table.
if
(
user
,
role
)
not
in
optimized_role_set
:
if
(
user
,
role
)
not
in
optimized_role_set
:
user_role_dict
[
role
]
=
user
# Only add to user_role_dict if not in optimized_role_set (double check)
user_role_dict
[
role
]
=
user
# Only add to user_role_dict if not in optimized_role_set (double check)
elif
not
(
role
in
role_dict
)
:
if
role
in
allowed_role_set
:
# add here local roles which are not part of optimized ones
user_view_permission_role_dict
[
role
]
=
user
# and at the same time not a special ones like Owner
elif
role
in
allowed_role_set
:
if
(
user
,
role
)
not
in
optimized_role_set
:
for
group
in
local_roles_group_id_group_id
.
get
(
user
,
(
''
,
))
:
user_group
=
'%s:%s'
%
(
prefix
,
role
)
try
:
if
prefix
not
in
allowed_role_set
:
group_allowed_set
=
allowed_by_local_roles_group_id
[
group
]
allowed_role_set
.
add
(
prefix
)
except
KeyError
:
if
user_group
not
in
allowed_role_set
:
allowed_by_local_roles_group_id
[
group
]
=
group_allowed_set
=
set
()
allowed_role_set
.
add
(
user_group
)
group_allowed_set
.
update
((
prefix
,
'%s:%s'
%
(
prefix
,
role
))
)
# sort `allowed` principals
# sort `allowed` principals
sorted_allowed_by_local_roles_group_id
=
{}
sorted_allowed_by_local_roles_group_id
=
{}
...
...
product/ERP5Security/tests/testERP5Security.py
View file @
8496736e
...
@@ -585,7 +585,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
...
@@ -585,7 +585,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
self
.
assertEqual
([
'Assignor'
],
obj
.
__ac_local_roles__
.
get
(
'F1_G1_S1'
))
self
.
assertEqual
([
'Assignor'
],
obj
.
__ac_local_roles__
.
get
(
'F1_G1_S1'
))
self
.
assertTrue
(
'Assignor'
in
user
.
getRolesInContext
(
obj
))
self
.
assertTrue
(
'Assignor'
in
user
.
getRolesInContext
(
obj
))
self
.
assertEqual
(
(
'F1_G1_S1'
,
),
self
.
assertEqual
(
set
([(
'F1_G1_S1'
,
'Assignor'
)]
),
obj
.
__ac_local_roles_group_id_dict__
.
get
(
'Alternate'
))
obj
.
__ac_local_roles_group_id_dict__
.
get
(
'Alternate'
))
self
.
abort
()
self
.
abort
()
...
...
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