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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tomáš Peterka
erp5
Commits
e33c642b
Commit
e33c642b
authored
Oct 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply changes and reindex only in case of local roles change.
parent
396cb756
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+7
-3
No files found.
product/ERP5Type/ERP5Type.py
View file @
e33c642b
...
@@ -80,6 +80,8 @@ class LocalRoleAssignorMixIn(object):
...
@@ -80,6 +80,8 @@ class LocalRoleAssignorMixIn(object):
"""
"""
Assign Local Roles to Groups on object 'ob', based on Portal Type Role
Assign Local Roles to Groups on object 'ob', based on Portal Type Role
Definitions and "ERP5 Role Definition" objects contained inside 'ob'.
Definitions and "ERP5 Role Definition" objects contained inside 'ob'.
Reindex is obsoleted, as there is modification detection.
"""
"""
if
user_name
is
None
:
if
user_name
is
None
:
# First try to guess from the owner
# First try to guess from the owner
...
@@ -93,16 +95,18 @@ class LocalRoleAssignorMixIn(object):
...
@@ -93,16 +95,18 @@ class LocalRoleAssignorMixIn(object):
## Update role assignments to groups
## Update role assignments to groups
# Save the owner
# Save the owner
current_roles
=
ob
.
__ac_local_roles__
for
group
,
role_list
in
(
ob
.
__ac_local_roles__
or
{}).
iteritems
():
for
group
,
role_list
in
(
ob
.
__ac_local_roles__
or
{}).
iteritems
():
if
'Owner'
in
role_list
:
if
'Owner'
in
role_list
:
group_id_role_dict
.
setdefault
(
group
,
set
()).
add
(
'Owner'
)
group_id_role_dict
.
setdefault
(
group
,
set
()).
add
(
'Owner'
)
# Assign new roles
# Assign new roles
ob
.
__ac_local_roles__
=
ac_local_roles
=
{}
ac_local_roles
=
{}
for
group
,
role_list
in
group_id_role_dict
.
iteritems
():
for
group
,
role_list
in
group_id_role_dict
.
iteritems
():
if
role_list
:
if
role_list
:
ac_local_roles
[
group
]
=
list
(
role_list
)
ac_local_roles
[
group
]
=
list
(
role_list
)
## Make sure that the object is reindexed
if
ac_local_roles
!=
current_roles
:
if
reindex
:
# apply changes and reindex only in case if roles has been changed
ob
.
__ac_local_roles__
=
ac_local_roles
ob
.
reindexObjectSecurity
()
ob
.
reindexObjectSecurity
()
security
.
declarePrivate
(
"getLocalRolesFor"
)
security
.
declarePrivate
(
"getLocalRolesFor"
)
...
...
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