Commit 0e0b9ca0 authored by iv's avatar iv

ERP5Workflow: fix testSecurity guard check

parent 3e532286
...@@ -121,7 +121,7 @@ class TestSecurityMixin(ERP5TypeTestCase): ...@@ -121,7 +121,7 @@ class TestSecurityMixin(ERP5TypeTestCase):
if getattr(transition, 'trigger_type', 1) == 0: if getattr(transition, 'trigger_type', 1) == 0:
# Automatic transition without guard is safe # Automatic transition without guard is safe
continue continue
if getattr(transition, 'guard', None) is None: if not transition.isGuarded():
error_list.append('%s/transitions/%s' % (wf.getId(), transition.getId())) error_list.append('%s/transitions/%s' % (wf.getId(), transition.getId()))
if error_list: if error_list:
message = '\nThe following %s workflow transitions are not guarded.\n\t%s' \ message = '\nThe following %s workflow transitions are not guarded.\n\t%s' \
......
...@@ -71,7 +71,6 @@ def WorkflowUIMixin_setProperties( self, title ...@@ -71,7 +71,6 @@ def WorkflowUIMixin_setProperties( self, title
WorkflowUIMixin_class.setProperties = WorkflowUIMixin_setProperties WorkflowUIMixin_class.setProperties = WorkflowUIMixin_setProperties
WorkflowUIMixin_class.manage_properties = DTMLFile('workflow_properties', _dtmldir) WorkflowUIMixin_class.manage_properties = DTMLFile('workflow_properties', _dtmldir)
def Guard_checkWithoutRoles(self, sm, wf_def, ob, **kw): def Guard_checkWithoutRoles(self, sm, wf_def, ob, **kw):
"""Checks conditions in this guard. """Checks conditions in this guard.
This function is the same as Guard.check, but roles are not taken This function is the same as Guard.check, but roles are not taken
...@@ -1094,6 +1093,10 @@ def DCWorkflowDefinition_deleteTransitions(self, name): ...@@ -1094,6 +1093,10 @@ def DCWorkflowDefinition_deleteTransitions(self, name):
def WorklistDefinition_getGuardRoleList(self): def WorklistDefinition_getGuardRoleList(self):
return self.getGuard().getRolesText().split(';') return self.getGuard().getRolesText().split(';')
def method_isGuarded(self):
guard = getattr(self, 'guard', None)
return guard is not None
DCWorkflowDefinition.addTransition = DCWorkflowDefinition_addTransition DCWorkflowDefinition.addTransition = DCWorkflowDefinition_addTransition
DCWorkflowDefinition.deleteTransitions = DCWorkflowDefinition_deleteTransitions DCWorkflowDefinition.deleteTransitions = DCWorkflowDefinition_deleteTransitions
DCWorkflowDefinition.getReference = method_getReference DCWorkflowDefinition.getReference = method_getReference
...@@ -1127,6 +1130,7 @@ StateDefinition.getStateTypeList = StateDefinition_getStateTypeList ...@@ -1127,6 +1130,7 @@ StateDefinition.getStateTypeList = StateDefinition_getStateTypeList
TransitionDefinition.getParentValue = TransitionDefinition_getParentValue TransitionDefinition.getParentValue = TransitionDefinition_getParentValue
TransitionDefinition.getReference = method_getReference TransitionDefinition.getReference = method_getReference
TransitionDefinition.showDict = DCWorkflowDefinition_showDict TransitionDefinition.showDict = DCWorkflowDefinition_showDict
TransitionDefinition.isGuarded = method_isGuarded
VariableDefinition.getReference = method_getReference VariableDefinition.getReference = method_getReference
VariableDefinition.showDict = DCWorkflowDefinition_showDict VariableDefinition.showDict = DCWorkflowDefinition_showDict
WorklistDefinition.getReference = method_getReference WorklistDefinition.getReference = method_getReference
......
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