Commit 84ac3b21 authored by Alexandre Boeglin's avatar Alexandre Boeglin

When using PAS and deleting roles, make sure we save the owner.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4431 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 583876d6
...@@ -238,6 +238,8 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -238,6 +238,8 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
""" """
Assign Local Roles to Groups on object, based on Portal Type Role Definitions Assign Local Roles to Groups on object, based on Portal Type Role Definitions
""" """
#FIXME We should check the type of the acl_users folder instead of
# checking which product is installed.
if ERP5UserManager is not None: if ERP5UserManager is not None:
user_name = getSecurityManager().getUser().getId() # We use id for roles in ERP5Security user_name = getSecurityManager().getUser().getId() # We use id for roles in ERP5Security
elif NuxUserGroups is not None: elif NuxUserGroups is not None:
...@@ -321,6 +323,13 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -321,6 +323,13 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
# Clean old group roles # Clean old group roles
old_group_list = object.get_local_roles() old_group_list = object.get_local_roles()
object.manage_delLocalRoles([x[0] for x in old_group_list]) object.manage_delLocalRoles([x[0] for x in old_group_list])
# Save the owner
for group, role_list in old_group_list:
if 'Owner' in role_list:
if group not in group_id_role_dict.keys():
group_id_role_dict[group] = ('Owner',)
else:
group_id_role_dict[group].append('Owner')
# Assign new roles # Assign new roles
for group, role_list in group_id_role_dict.items(): for group, role_list in group_id_role_dict.items():
object.manage_addLocalRoles(group, role_list) object.manage_addLocalRoles(group, role_list)
...@@ -332,7 +341,6 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -332,7 +341,6 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
for group, role_list in group_id_role_dict.items(): for group, role_list in group_id_role_dict.items():
object.manage_addLocalGroupRoles(group, role_list) object.manage_addLocalGroupRoles(group, role_list)
security.declarePublic('getFilteredRoleListFor') security.declarePublic('getFilteredRoleListFor')
def getFilteredRoleListFor(self, object=None, **kw): def getFilteredRoleListFor(self, object=None, **kw):
""" """
......
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