Commit f1b70f2c authored by Jean-Paul Smets's avatar Jean-Paul Smets

asSecurityGroupId scripts can now return either string or list

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12980 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 618cb1d1
......@@ -145,38 +145,26 @@ class ERP5GroupManager(BasePlugin):
# Get group names from category values
group_id_list_generator = getattr(self,
'ERP5Type_asSecurityGroupIdList', None)
if group_id_list_generator is not None:
for base_category_list, category_value_list in \
security_category_dict.items():
for category_dict in category_value_list:
try:
security_group_list.extend(
group_id_list_generator(category_order=base_category_list,
**category_dict)
)
except ConflictError:
raise
except:
LOG('ERP5GroupManager', WARNING,
'could not get security groups from '
'ERP5Type_asSecurityGroupIdList',
error = sys.exc_info())
if group_id_list_generator is None:
group_id_list_generator = getattr(self, 'ERP5Type_asSecurityGroupId')
generator_name = "ERP5Type_asSecurityGroupId"
else:
group_id_generator = getattr(self, 'ERP5Type_asSecurityGroupId')
generator_name = 'ERP5Type_asSecurityGroupIdList'
for base_category_list, category_value_list in \
security_category_dict.items():
for category_dict in category_value_list:
try:
security_group_list.append(
group_id_generator(category_order=base_category_list,
group_id_list = group_id_list_generator(category_order=base_category_list,
**category_dict)
)
LOG('group_id_list', 0, str(group_id_list))
if isinstance(group_id_list, str): group_id_list = [group_id_list]
security_group_list.extend(group_id_list)
except ConflictError:
raise
except:
LOG('ERP5GroupManager', WARNING,
'could not get security groups from '
'ERP5Type_asSecurityGroupId',
'could not get security groups from %s' %
generator_name,
error = sys.exc_info())
finally:
setSecurityManager(sm)
......@@ -189,7 +177,6 @@ class ERP5GroupManager(BasePlugin):
path=self.getPhysicalPath())
classImplements( ERP5GroupManager
, IGroupsPlugin
)
......
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