From 3bc3edcf42f249ad266935522ba45afb390fae47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Fri, 9 Feb 2007 16:25:27 +0000 Subject: [PATCH] Some cleanup; added base dependency. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12606 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../asSecurityGroupIdList.py | 86 ------------- .../reviewer.xml => knowledge.xml} | 16 +-- .../{hq.xml => knowledge/contributor.xml} | 30 +++-- .../function/knowledge/manager.xml | 115 ++++++++++++++++++ bt5/erp5_dms/bt/dependency_list | 1 + bt5/erp5_dms/bt/revision | 2 +- bt5/erp5_dms/bt/template_extension_id_list | 1 - bt5/erp5_dms/bt/template_path_list | 6 +- 8 files changed, 139 insertions(+), 118 deletions(-) delete mode 100644 bt5/erp5_dms/ExtensionTemplateItem/asSecurityGroupIdList.py rename bt5/erp5_dms/PathTemplateItem/portal_categories/function/{publication/reviewer.xml => knowledge.xml} (86%) rename bt5/erp5_dms/PathTemplateItem/portal_categories/function/{hq.xml => knowledge/contributor.xml} (84%) create mode 100644 bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/manager.xml diff --git a/bt5/erp5_dms/ExtensionTemplateItem/asSecurityGroupIdList.py b/bt5/erp5_dms/ExtensionTemplateItem/asSecurityGroupIdList.py deleted file mode 100644 index 198d4e0c45..0000000000 --- a/bt5/erp5_dms/ExtensionTemplateItem/asSecurityGroupIdList.py +++ /dev/null @@ -1,86 +0,0 @@ -from Products.ERP5Type.Utils import cartesianProduct - -def asSecurityGroupIdList(self, category_order=None, **kw): - # category_order : list of base_categories we want to use to generate the group id - # kw : keys should be base categories, - # values should be value of corresponding relative urls (obtained by getBaseCategory()) - # - # Example call : self.ERP5TypeSecurity_asGroupId(category_order=('site', 'group', 'function'), - # site='france/lille', group='nexedi', function='accounting/accountant') - # This will generate a string like 'LIL_NXD_ACT' where "LIL", "NXD" and "ACT" are the codification - # of respecively "france/lille", "nexedi" and "accounting/accountant" categories - # - # ERP5Type_asSecurityGroupId can also return a list of users whenever a category points - # to a Person instance. This is useful to implement user based local role assignments - code_list = [] - user_list = [] - - # sort the category list lexicographically - # this prevents us to choose the exact order we want, - # but also prevents some human mistake to break everything by creating site_function instead of function_site - if category_order not in (None, ''): - category_order = list(category_order) - category_order.sort() - else: - category_order = [] - - code_dict = {} - for base_category in category_order: - code_dict[base_category] = [] - category_list = kw[base_category] - if isinstance(category_list, str): - category_list = [category_list] - for category in category_list: - category_path = '%s/%s' % (base_category, category) - category_object = self.portal_categories.getCategoryValue(category_path) - if category_object in (None, ''): - raise RuntimeError, "Category '%s' doesn't exist" % (category_path) - if category_object.getPortalType() == 'Person': - # We define a person here - user_name = category_object.getReference() - if user_name is not None: user_list.append(user_name) - else: - # We define a group item here - try: - category_code = category_object.getCodification() - except AttributeError: - category_code = category_object.getReference() - if category_code not in code_dict[base_category]: - code_dict[base_category].append(category_code) - if base_category=='site': - category_object = category_object.getParentValue() - while category_object.getPortalType()!='Base Category': - # LOG('checking category_object:',0,category_object.getRelativeUrl()) - category_code = category_object.getCodification() - if category_code is not None and category_code not in code_dict[base_category]: - code_dict[base_category].append(category_code) - category_object = category_object.getParentValue() - #code_list.append(category_code) - - # Return a list of users or a single group - #LOG('asSecurityGroupIdList, user_list',0,user_list) - if user_list: return user_list - - # LOG('asSecurityGroupIdList, code_dict',0,code_dict) - def getCombinationList(item_list): - if len(item_list): - result = getCombinationList(item_list[1:]) - return [item_list[:1] + x for x in result] + result - return [[]] - - code_list_of_list = [] - for base_category in category_order: - code_list_of_list.append(code_dict[base_category]) - full_code_list = [] - for code_list in cartesianProduct(code_list_of_list): - for x in getCombinationList(code_list): - if len(x): - # we have to sort it to match these in object local roles - x.sort() - full_code_list.extend(['_'.join(x) ]) - - #LOG('asSecurityGroupIdList, result',0,['_'.join(x) for x in getCombinationList(code_list) if len(x)]) - #return ['_'.join(x) for x in getCombinationList(code_list) if len(x)] - #LOG('asSecurityGroupIdList', 0, 'return full_code_list = %s' %(full_code_list,)) - self.log('full_code_list',full_code_list) - return full_code_list diff --git a/bt5/erp5_dms/PathTemplateItem/portal_categories/function/publication/reviewer.xml b/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge.xml similarity index 86% rename from bt5/erp5_dms/PathTemplateItem/portal_categories/function/publication/reviewer.xml rename to bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge.xml index 495f37b279..37c4f84d23 100644 --- a/bt5/erp5_dms/PathTemplateItem/portal_categories/function/publication/reviewer.xml +++ b/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge.xml @@ -40,14 +40,10 @@ <key> <string>categories</string> </key> <value> <tuple> - <string>function/publication/reviewer</string> + <string>function/knowledge</string> </tuple> </value> </item> - <item> - <key> <string>codification</string> </key> - <value> <string>REVIEWER</string> </value> - </item> <item> <key> <string>description</string> </key> <value> @@ -56,13 +52,11 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>reviewer</string> </value> + <value> <string>knowledge</string> </value> </item> <item> - <key> <string>int_index</string> </key> - <value> - <none/> - </value> + <key> <string>last_id</string> </key> + <value> <string>1</string> </value> </item> <item> <key> <string>portal_type</string> </key> @@ -70,7 +64,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>Reviewer</string> </value> + <value> <string>Knowledge</string> </value> </item> <item> <key> <string>uid</string> </key> diff --git a/bt5/erp5_dms/PathTemplateItem/portal_categories/function/hq.xml b/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/contributor.xml similarity index 84% rename from bt5/erp5_dms/PathTemplateItem/portal_categories/function/hq.xml rename to bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/contributor.xml index ae8a452948..0ddfc0f2a7 100644 --- a/bt5/erp5_dms/PathTemplateItem/portal_categories/function/hq.xml +++ b/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/contributor.xml @@ -4,7 +4,7 @@ <pickle> <tuple> <tuple> - <string>Products.ERP5.Tool.Category</string> + <string>Products.ERP5Type.Document.Category</string> <string>Category</string> </tuple> <none/> @@ -30,12 +30,6 @@ <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </value> </item> - <item> - <key> <string>_owner</string> </key> - <value> - <none/> - </value> - </item> <item> <key> <string>_tree</string> </key> <value> @@ -43,26 +37,30 @@ </value> </item> <item> - <key> <string>codification</string> </key> - <value> <string>HQ</string> </value> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>function/knowledge/contributor</string> + </tuple> + </value> </item> <item> <key> <string>description</string> </key> - <value> <string></string> </value> + <value> + <none/> + </value> </item> <item> <key> <string>id</string> </key> - <value> <string>hq</string> </value> + <value> <string>contributor</string> </value> </item> <item> - <key> <string>int_index</string> </key> - <value> - <none/> - </value> + <key> <string>portal_type</string> </key> + <value> <string>Category</string> </value> </item> <item> <key> <string>title</string> </key> - <value> <string>HQ</string> </value> + <value> <string>Contributor</string> </value> </item> <item> <key> <string>uid</string> </key> diff --git a/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/manager.xml b/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/manager.xml new file mode 100644 index 0000000000..adc534dc0a --- /dev/null +++ b/bt5/erp5_dms/PathTemplateItem/portal_categories/function/knowledge/manager.xml @@ -0,0 +1,115 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.ERP5Type.Document.Category</string> + <string>Category</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>function/knowledge/manager</string> + <string>function/knowledge/manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>manager</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Manager</string> </value> + </item> + <item> + <key> <string>uid</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <tuple> + <string>BTrees.Length</string> + <string>Length</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <tuple> + <tuple> + <string>BTrees.OOBTree</string> + <string>OOBTree</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <tuple> + <tuple> + <string>BTrees.OOBTree</string> + <string>OOBTree</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/bt/dependency_list b/bt5/erp5_dms/bt/dependency_list index e69de29bb2..1037d15c20 100644 --- a/bt5/erp5_dms/bt/dependency_list +++ b/bt5/erp5_dms/bt/dependency_list @@ -0,0 +1 @@ +erp5_base \ No newline at end of file diff --git a/bt5/erp5_dms/bt/revision b/bt5/erp5_dms/bt/revision index 22c04b349c..2e790af68a 100644 --- a/bt5/erp5_dms/bt/revision +++ b/bt5/erp5_dms/bt/revision @@ -1 +1 @@ -508 \ No newline at end of file +510 \ No newline at end of file diff --git a/bt5/erp5_dms/bt/template_extension_id_list b/bt5/erp5_dms/bt/template_extension_id_list index 32475dc2f4..8d620305e5 100644 --- a/bt5/erp5_dms/bt/template_extension_id_list +++ b/bt5/erp5_dms/bt/template_extension_id_list @@ -1,4 +1,3 @@ -asSecurityGroupIdList searchUtils mailUtils cutFound diff --git a/bt5/erp5_dms/bt/template_path_list b/bt5/erp5_dms/bt/template_path_list index c28bf996b1..b36fedbf2b 100644 --- a/bt5/erp5_dms/bt/template_path_list +++ b/bt5/erp5_dms/bt/template_path_list @@ -1,3 +1,3 @@ -portal_categories/function/hq -portal_categories/function/publication -portal_categories/function/publication/reviewer \ No newline at end of file +portal_categories/function/knowledge +portal_categories/function/knowledge/contributor +portal_categories/function/knowledge/manager \ No newline at end of file -- 2.30.9