From 924823ec4297182c143da8b9be5eab55c246a0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 15 Jul 2020 16:07:42 +0900 Subject: [PATCH] configurator: remove WorkflowSecurityConfiguratorItem this class does nothing and does not seem used --- .../view.xml | 79 ----------- ...t.erp5.WorkflowSecurityConfiguratorItem.py | 130 ------------------ ....erp5.WorkflowSecurityConfiguratorItem.xml | 113 --------------- .../allowed_content_types.xml | 1 - ...kflow%20Security%20Configurator%20Item.xml | 32 ----- .../bt/template_action_path_list | 1 - .../bt/template_document_id_list | 3 +- ...late_portal_type_allowed_content_type_list | 1 - .../bt/template_portal_type_id_list | 3 +- 9 files changed, 2 insertions(+), 361 deletions(-) delete mode 100644 bt5/erp5_configurator/ActionTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item/view.xml delete mode 100644 bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.py delete mode 100644 bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.xml delete mode 100644 bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item.xml diff --git a/bt5/erp5_configurator/ActionTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item/view.xml b/bt5/erp5_configurator/ActionTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item/view.xml deleted file mode 100644 index 56391a5c36..0000000000 --- a/bt5/erp5_configurator/ActionTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item/view.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>action</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> - </item> - <item> - <key> <string>categories</string> </key> - <value> - <tuple> - <string>action_type/object_view</string> - </tuple> - </value> - </item> - <item> - <key> <string>category</string> </key> - <value> <string>object_view</string> </value> - </item> - <item> - <key> <string>condition</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>icon</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>view</string> </value> - </item> - <item> - <key> <string>permissions</string> </key> - <value> - <tuple> - <string>View</string> - </tuple> - </value> - </item> - <item> - <key> <string>priority</string> </key> - <value> <float>1.0</float> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string>View</string> </value> - </item> - <item> - <key> <string>visible</string> </key> - <value> <int>1</int> </value> - </item> - </dictionary> - </pickle> - </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="Expression" module="Products.CMFCore.Expression"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>text</string> </key> - <value> <string>string:${object_url}/ConfiguratorItem_view</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.py b/bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.py deleted file mode 100644 index 06d39a05ce..0000000000 --- a/bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.py +++ /dev/null @@ -1,130 +0,0 @@ -############################################################################## -# -# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved. -# Ivan Tyagov <ivan@nexedi.com> -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract a Free Software -# Service Company -# -# This program is Free Software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -import zope.interface -from AccessControl import ClassSecurityInfo -from Products.ERP5Type import Permissions, PropertySheet, interfaces -from Products.ERP5Type.XMLObject import XMLObject -from erp5.component.mixin.ConfiguratorItemMixin import ConfiguratorItemMixin -from erp5.component.interface.IConfiguratorItem import IConfiguratorItem - -class WorkflowSecurityConfiguratorItem(ConfiguratorItemMixin, XMLObject): - """ Setup workflow for different roles. Use passed OO file. """ - - meta_type = 'ERP5 Workflow Security Configurator Item' - portal_type = 'Workflow Security Configurator Item' - add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - - # Declarative security - security = ClassSecurityInfo() - security.declareObjectProtected(Permissions.AccessContentsInformation) - - # Declarative interfaces - zope.interface.implements(IConfiguratorItem) - - # Declarative properties - property_sheets = ( PropertySheet.Base - , PropertySheet.XMLObject - , PropertySheet.CategoryCore - , PropertySheet.DublinCore ) - - def _checkConsistency(self, fixit=False, filter=None, **kw): - return [] - if fixit: - ## NOT TESTED - business_configuration = self.getBusinessConfigurationValue() - table_dict = business_configuration.ConfigurationTemplate_readOOCalcFile(self.filename) - portal = self.getPortalObject() - suffix = '_security' - suffix_len = len(suffix) - if self.filename[-suffix_len:] == suffix: - workflow_id = self.filename[:-suffix_len] - else: - raise "NoValidName" - - # Configure state permission - view_permission_list = ['View'] - access_permission_list = ['Access contents information'] - modify_permission_list = ['Modify portal content'] - add_content_permission_list = ['Add portal content'] - # Configure list of variable on the workflow - permission_list = view_permission_list + \ - access_permission_list + \ - modify_permission_list + \ - add_content_permission_list - # Remove permission list - workflow = portal.portal_workflow[workflow_id] - workflow.delManagedPermissions(workflow.permissions) - # Add new permission list - for permission in permission_list: - workflow.addManagedPermission(permission) - # Configure state permission matrix - state_list = table_dict['state'] - for state_config in state_list: - state_id = state_config.pop('state') - state = workflow.states[state_id] - # Clean the state matrix - for permission in permission_list: - state.setPermission(permission, 0, []) - # Update state matrix - permission_dict = {x: [] for x in permission_list} - for role, perm_symbol in state_config.items(): - managed_permission_list = [] - if 'A' in perm_symbol: - managed_permission_list.extend(access_permission_list) - if 'V' in perm_symbol: - managed_permission_list.extend(view_permission_list) - if 'C' in perm_symbol: - managed_permission_list.extend(add_content_permission_list) - if 'M' in perm_symbol: - managed_permission_list.extend(modify_permission_list) - for permission in managed_permission_list: - permission_dict[permission].append(role.capitalize()) - for permission, roles in permission_dict.items(): - state.setPermission(permission, 0, roles) - # XXX To be deleted - # for permission in permission_list: - # module.manage_permission(permission, ['Manager'], 0) - - # Configure transition guard - transition_list = table_dict['transition'] - for transition_conf in transition_list: - transition_id = transition_conf.pop('transition') - transition = workflow.transitions[transition_id] - guard = transition.getGuard() - role_list = [x.capitalize() for x in transition_conf.keys()] - role_string = ';'.join(role_list) - guard.changeFromProperties({'guard_roles': role_string}) - # Update business template - bt5_obj = business_configuration.getSpecialiseValue() - template_workflow_id_list = list(bt5_obj.getTemplateWorkflowIdList()) - if workflow_id not in template_workflow_id_list: - template_workflow_id_list.append(workflow_id) - bt5_obj.edit(template_workflow_id_list=template_workflow_id_list,) diff --git a/bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.xml b/bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.xml deleted file mode 100644 index 6bc73f500e..0000000000 --- a/bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.WorkflowSecurityConfiguratorItem.xml +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Document Component" module="erp5.portal_type"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>default_reference</string> </key> - <value> <string>WorkflowSecurityConfiguratorItem</string> </value> - </item> - <item> - <key> <string>default_source_reference</string> </key> - <value> <string>Products.ERP5Configurator.Document.WorkflowSecurityConfiguratorItem</string> </value> - </item> - <item> - <key> <string>description</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>document.erp5.WorkflowSecurityConfiguratorItem</string> </value> - </item> - <item> - <key> <string>portal_type</string> </key> - <value> <string>Document Component</string> </value> - </item> - <item> - <key> <string>sid</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>text_content_error_message</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>text_content_warning_message</string> </key> - <value> - <tuple> - <string>W: 57, 43: Redefining built-in \'filter\' (redefined-builtin)</string> - <string>W: 59, 4: Unreachable code (unreachable)</string> - </tuple> - </value> - </item> - <item> - <key> <string>version</string> </key> - <value> <string>erp5</string> </value> - </item> - <item> - <key> <string>workflow_history</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> - </item> - </dictionary> - </pickle> - </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="PersistentMapping" module="Persistence.mapping"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>data</string> </key> - <value> - <dictionary> - <item> - <key> <string>component_validation_workflow</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> - </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </pickle> - </record> - <record id="3" aka="AAAAAAAAAAM="> - <pickle> - <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_log</string> </key> - <value> - <list> - <dictionary> - <item> - <key> <string>action</string> </key> - <value> <string>validate</string> </value> - </item> - <item> - <key> <string>validation_state</string> </key> - <value> <string>validated</string> </value> - </item> - </dictionary> - </list> - </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml index 4912ae9da6..26356686f7 100644 --- a/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml +++ b/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml @@ -44,7 +44,6 @@ <item>Solver Configurator Item</item> <item>Standard BT5 Configurator Item</item> <item>System Preference Configurator Item</item> - <item>Workflow Security Configurator Item</item> </portal_type> <portal_type id="Organisation Configurator Item"> <item>Address</item> diff --git a/bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item.xml b/bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item.xml deleted file mode 100644 index a383af1fd9..0000000000 --- a/bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Workflow%20Security%20Configurator%20Item.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Base Type" module="erp5.portal_type"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>content_icon</string> </key> - <value> <string>document.gif</string> </value> - </item> - <item> - <key> <string>content_meta_type</string> </key> - <value> <string>ERP5 Workflow Security Configurator Item</string> </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string> Setup workflow for different roles. Use passed OO file. </string> </value> - </item> - <item> - <key> <string>factory</string> </key> - <value> <string>addWorkflowSecurityConfiguratorItem</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>Workflow Security Configurator Item</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_configurator/bt/template_action_path_list b/bt5/erp5_configurator/bt/template_action_path_list index d65cf7778a..434783f48a 100644 --- a/bt5/erp5_configurator/bt/template_action_path_list +++ b/bt5/erp5_configurator/bt/template_action_path_list @@ -27,7 +27,6 @@ Site Property Configurator Item | view Solver Configurator Item | view Standard BT5 Configurator Item | view System Preference Configurator Item | view -Workflow Security Configurator Item | view Workflow | configurator_settings Workflow | launch_configuration portal_actions | use_configurator \ No newline at end of file diff --git a/bt5/erp5_configurator/bt/template_document_id_list b/bt5/erp5_configurator/bt/template_document_id_list index 500676027e..d37ec3f1ee 100644 --- a/bt5/erp5_configurator/bt/template_document_id_list +++ b/bt5/erp5_configurator/bt/template_document_id_list @@ -27,5 +27,4 @@ document.erp5.ServiceConfiguratorItem document.erp5.SitePropertyConfiguratorItem document.erp5.SolverConfiguratorItem document.erp5.StandardBT5ConfiguratorItem -document.erp5.SystemPreferenceConfiguratorItem -document.erp5.WorkflowSecurityConfiguratorItem \ No newline at end of file +document.erp5.SystemPreferenceConfiguratorItem \ No newline at end of file diff --git a/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list index 1372997215..0c0ca4c6cf 100644 --- a/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list +++ b/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list @@ -34,7 +34,6 @@ Configuration Save | Site Property Configurator Item Configuration Save | Solver Configurator Item Configuration Save | Standard BT5 Configurator Item Configuration Save | System Preference Configurator Item -Configuration Save | Workflow Security Configurator Item Organisation Configurator Item | Address Organisation Configurator Item | Email Organisation Configurator Item | Telephone diff --git a/bt5/erp5_configurator/bt/template_portal_type_id_list b/bt5/erp5_configurator/bt/template_portal_type_id_list index 88c3441bdc..ebeee91ade 100644 --- a/bt5/erp5_configurator/bt/template_portal_type_id_list +++ b/bt5/erp5_configurator/bt/template_portal_type_id_list @@ -29,5 +29,4 @@ Service Configurator Item Site Property Configurator Item Solver Configurator Item Standard BT5 Configurator Item -System Preference Configurator Item -Workflow Security Configurator Item \ No newline at end of file +System Preference Configurator Item \ No newline at end of file -- 2.30.9