Commit 1060185f authored by Julien Muchembled's avatar Julien Muchembled

Reset Owner role to object owner when updating local roles

parent 6a8987fb
...@@ -86,10 +86,15 @@ class LocalRoleAssignorMixIn(object): ...@@ -86,10 +86,15 @@ class LocalRoleAssignorMixIn(object):
owner = ob.getOwnerTuple() owner = ob.getOwnerTuple()
if owner: if owner:
user_name = owner[1] user_name = owner[1]
else:
for group, role_list in (ob.__ac_local_roles__ or {}).iteritems():
if 'Owner' in role_list:
user_name = group
break
else: else:
user_name = getSecurityManager().getUser().getId() user_name = getSecurityManager().getUser().getId()
group_id_role_dict = {} group_id_role_dict = {user_name: set(('Owner',))}
local_roles_group_id_group_id = {} local_roles_group_id_group_id = {}
# Merge results from applicable roles # Merge results from applicable roles
for role_generator in self.getFilteredRoleListFor(ob): for role_generator in self.getFilteredRoleListFor(ob):
...@@ -110,10 +115,6 @@ class LocalRoleAssignorMixIn(object): ...@@ -110,10 +115,6 @@ class LocalRoleAssignorMixIn(object):
local_roles_group_id_group_id.setdefault(local_roles_group_id, set()).update(((group_id, role),)) local_roles_group_id_group_id.setdefault(local_roles_group_id, set()).update(((group_id, role),))
## Update role assignments to groups ## Update role assignments to groups
# Save the owner
for group, role_list in (ob.__ac_local_roles__ or {}).iteritems():
if 'Owner' in role_list:
group_id_role_dict.setdefault(group, set()).add('Owner')
# Assign new roles # Assign new 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():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment