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

Added support for acquired security.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12894 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 736d6e41
...@@ -470,8 +470,6 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -470,8 +470,6 @@ class ERP5TypeInformation( FactoryTypeInformation,
# instead of a dict or list of dicts # instead of a dict or list of dicts
if category_result is None: if category_result is None:
continue continue
elif isinstance(category_result, dict):
category_result = [category_result]
else: else:
raise RuntimeError, 'Script %s was not found to fetch values for'\ raise RuntimeError, 'Script %s was not found to fetch values for'\
' base categories : %s' % (base_category_script_id, ' base categories : %s' % (base_category_script_id,
...@@ -484,11 +482,16 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -484,11 +482,16 @@ class ERP5TypeInformation( FactoryTypeInformation,
category_result = [{}] category_result = [{}]
for role in role_text.split(';'): for role in role_text.split(';'):
role = role.strip()
if isinstance(category_result, dict):
# category_result is a dict (which provide group IDs directly)
# which represents of mapping of roles, security group IDs
role_category_list_dict.setdefault(role, category_result)
else:
# category_result is a list of dicts that represents the resolved # category_result is a list of dicts that represents the resolved
# categories we create a category_value_dict from each of these # categories we create a category_value_dict from each of these
# dicts aggregated with category_order and statically defined # dicts aggregated with category_order and statically defined
# categories # categories
role = role.strip()
role_category_list = role_category_list_dict.setdefault(role, []) role_category_list = role_category_list_dict.setdefault(role, [])
for category_dict in category_result: for category_dict in category_result:
category_value_dict = {'category_order':category_order_list} category_value_dict = {'category_order':category_order_list}
...@@ -507,6 +510,11 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -507,6 +510,11 @@ class ERP5TypeInformation( FactoryTypeInformation,
raise RuntimeError, '%s script was not found' % \ raise RuntimeError, '%s script was not found' % \
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
for role, value_list in role_category_list_dict.items(): for role, value_list in role_category_list_dict.items():
if isinstance(value_list, dict):
# value_list is a dict (which provide group IDs directly)
# This is used by acquisition scripts
role_group_id_dict.setdefault(role, []).extend(value_list.get(role, []))
continue
role_group_dict = {} role_group_dict = {}
for category_dict in value_list: for category_dict in value_list:
group_id = group_id_generator(**category_dict) group_id = group_id_generator(**category_dict)
......
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