From add6e495432d476fe354dd2d647b224e200769e8 Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Sat, 21 Jan 2006 09:35:13 +0000 Subject: [PATCH] Ignore empty or None group/user in local role assignment git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5222 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/ERP5Type.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index b5688811b4..8c0b99b558 100755 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -311,13 +311,16 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): role_group_dict = {} for category_dict in value_list: group_id = group_id_generator(**category_dict) - if type(group_id) is type('a'): - # Single group is defined - role_group_dict[group_id] = 1 - else: - # Multiple users defined - for user_id in group_id: - role_group_dict[user_id] = 1 + # If group_id is not defined, do not use it + if group_id not in (None, ''): + if type(group_id) is type('a'): + # Single group is defined (this is usually for group membership) + role_group_dict[group_id] = 1 + else: + # Multiple groups are defined (this is usually for users) + # but it could be extended to ad hoc groups + for user_id in group_id: + role_group_dict[user_id] = 1 role_group_id_dict[role].extend(role_group_dict.keys()) # Switch index from role to group id -- 2.30.9