Soften dependency on ERP5Type_getSecurityCategoryMapping by duplicating code...

Soften dependency on ERP5Type_getSecurityCategoryMapping by duplicating code from ERP5GroupManager so it can be removed from erp5_core.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37990 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 88869d90
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -58,7 +55,16 @@ ...@@ -58,7 +55,16 @@
group_id_list_generator = getattr(context, \'ERP5Type_asSecurityGroupId\')\n group_id_list_generator = getattr(context, \'ERP5Type_asSecurityGroupId\')\n
\n \n
security_category_dict = {}\n security_category_dict = {}\n
for method_id, base_category_list in context.ERP5Type_getSecurityCategoryMapping():\n # XXX This is a duplicate of logic present deep inside ERP5GroupManager.getGroupsForPrincipal()\n
# Please refactor into an accessible method so this code can be removed\n
def getDefaultSecurityCategoryMapping():\n
return ((\n
\'ERP5Type_getSecurityCategoryFromAssignment\',\n
context.getPortalObject().getPortalAssignmentBaseCategoryList()\n
),)\n
getSecurityCategoryMapping = getattr(context, \'ERP5Type_getSecurityCategoryMapping\', getDefaultSecurityCategoryMapping)\n
# XXX end of code duplication\n
for method_id, base_category_list in getSecurityCategoryMapping():\n
try:\n try:\n
security_category_dict.setdefault(tuple(base_category_list), []).extend(\n security_category_dict.setdefault(tuple(base_category_list), []).extend(\n
getattr(context, method_id)(base_category_list, login, context, \'\'))\n getattr(context, method_id)(base_category_list, login, context, \'\'))\n
...@@ -126,10 +132,12 @@ return printed\n ...@@ -126,10 +132,12 @@ return printed\n
<string>context</string> <string>context</string>
<string>group_id_list_generator</string> <string>group_id_list_generator</string>
<string>security_category_dict</string> <string>security_category_dict</string>
<string>getDefaultSecurityCategoryMapping</string>
<string>getSecurityCategoryMapping</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>_getattr_</string>
<string>method_id</string> <string>method_id</string>
<string>base_category_list</string> <string>base_category_list</string>
<string>_getattr_</string>
<string>tuple</string> <string>tuple</string>
<string>category_value_list</string> <string>category_value_list</string>
<string>category_dict</string> <string>category_dict</string>
......
104 112
\ No newline at end of file \ No newline at end of file
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