Commit 924823ec authored by Jérome Perrin's avatar Jérome Perrin

configurator: remove WorkflowSecurityConfiguratorItem

this class does nothing and does not seem used
parent e46b6c6f
<?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>
##############################################################################
#
# 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,)
<?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>
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
<item>Solver Configurator Item</item> <item>Solver Configurator Item</item>
<item>Standard BT5 Configurator Item</item> <item>Standard BT5 Configurator Item</item>
<item>System Preference Configurator Item</item> <item>System Preference Configurator Item</item>
<item>Workflow Security Configurator Item</item>
</portal_type> </portal_type>
<portal_type id="Organisation Configurator Item"> <portal_type id="Organisation Configurator Item">
<item>Address</item> <item>Address</item>
......
<?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>
...@@ -27,7 +27,6 @@ Site Property Configurator Item | view ...@@ -27,7 +27,6 @@ Site Property Configurator Item | view
Solver Configurator Item | view Solver Configurator Item | view
Standard BT5 Configurator Item | view Standard BT5 Configurator Item | view
System Preference Configurator Item | view System Preference Configurator Item | view
Workflow Security Configurator Item | view
Workflow | configurator_settings Workflow | configurator_settings
Workflow | launch_configuration Workflow | launch_configuration
portal_actions | use_configurator portal_actions | use_configurator
\ No newline at end of file
...@@ -28,4 +28,3 @@ document.erp5.SitePropertyConfiguratorItem ...@@ -28,4 +28,3 @@ document.erp5.SitePropertyConfiguratorItem
document.erp5.SolverConfiguratorItem document.erp5.SolverConfiguratorItem
document.erp5.StandardBT5ConfiguratorItem document.erp5.StandardBT5ConfiguratorItem
document.erp5.SystemPreferenceConfiguratorItem document.erp5.SystemPreferenceConfiguratorItem
document.erp5.WorkflowSecurityConfiguratorItem
\ No newline at end of file
...@@ -34,7 +34,6 @@ Configuration Save | Site Property Configurator Item ...@@ -34,7 +34,6 @@ Configuration Save | Site Property Configurator Item
Configuration Save | Solver Configurator Item Configuration Save | Solver Configurator Item
Configuration Save | Standard BT5 Configurator Item Configuration Save | Standard BT5 Configurator Item
Configuration Save | System Preference Configurator Item Configuration Save | System Preference Configurator Item
Configuration Save | Workflow Security Configurator Item
Organisation Configurator Item | Address Organisation Configurator Item | Address
Organisation Configurator Item | Email Organisation Configurator Item | Email
Organisation Configurator Item | Telephone Organisation Configurator Item | Telephone
......
...@@ -30,4 +30,3 @@ Site Property Configurator Item ...@@ -30,4 +30,3 @@ Site Property Configurator Item
Solver Configurator Item Solver Configurator Item
Standard BT5 Configurator Item Standard BT5 Configurator Item
System Preference Configurator Item System Preference Configurator Item
Workflow Security Configurator Item
\ 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