Commit d28b12e9 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Support ERP5Type_asSecurityGroupIdList to get a list of groups for a given...

Support ERP5Type_asSecurityGroupIdList to get a list of groups for a given user. Remove unnecessary heavy pickling.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6006 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cfee0cd5
......@@ -124,21 +124,26 @@ class ERP5GroupManager(BasePlugin):
# Fetch category values from defined scripts
for (method_name, base_category_list) in \
security_definition_list:
pickled_category_list = dumps(base_category_list)
base_category_list = tuple(base_category_list)
method = getattr(self, method_name)
if not security_category_dict.has_key(pickled_category_list):
security_category_dict[pickled_category_list] = []
security_category_dict[pickled_category_list].extend(
method(base_category_list, person_id, person_object, ''))
security_category_list = security_category_dict.setdefault(base_category_list, [])
security_category_list.extend(method(base_category_list, person_id, person_object, ''))
# Get group names from category values
group_id_generator = getattr(self, 'ERP5Type_asSecurityGroupId')
for pickled_category_list, category_value_list in \
security_category_dict.items():
base_category_list = loads(pickled_category_list)
for category_dict in category_value_list:
security_group_list.append(group_id_generator(
category_order=base_category_list, **category_dict))
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:
security_group_list.extend(group_id_list_generator(
category_order=base_category_list, **category_dict))
else:
group_id_generator = getattr(self, 'ERP5Type_asSecurityGroupId')
for base_category_list, category_value_list in \
security_category_dict.items():
for category_dict in category_value_list:
security_group_list.append(group_id_generator(
category_order=base_category_list, **category_dict))
setSecurityManager(sm)
return tuple(security_group_list)
......
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