From 1060185fe1e9ccb790a6e87f56997c52ad831b8c Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Thu, 9 Oct 2014 12:15:37 +0200 Subject: [PATCH] Reset Owner role to object owner when updating local roles --- product/ERP5Type/ERP5Type.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 22d7d79282..c8d522ee18 100644 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -87,9 +87,14 @@ class LocalRoleAssignorMixIn(object): if owner: user_name = owner[1] else: - user_name = getSecurityManager().getUser().getId() - - group_id_role_dict = {} + for group, role_list in (ob.__ac_local_roles__ or {}).iteritems(): + if 'Owner' in role_list: + user_name = group + break + else: + user_name = getSecurityManager().getUser().getId() + + group_id_role_dict = {user_name: set(('Owner',))} local_roles_group_id_group_id = {} # Merge results from applicable roles for role_generator in self.getFilteredRoleListFor(ob): @@ -110,10 +115,6 @@ class LocalRoleAssignorMixIn(object): local_roles_group_id_group_id.setdefault(local_roles_group_id, set()).update(((group_id, role),)) ## 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 ac_local_roles = {} for group, role_list in group_id_role_dict.iteritems(): -- 2.30.9