Commit ff13da35 authored by iv's avatar iv

ERP5Workflow: remove some old guards kept by mistake

creating a guard when all the informations are already in properties
of the object is useless, these guards were forgotten
parent 5c64db76
...@@ -137,8 +137,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -137,8 +137,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
break break
if vdef is _MARKER: if vdef is _MARKER:
return default return default
if vdef.getInfoGuard() is not None and not vdef.getInfoGuard().check( if not vdef.checkGuard(getSecurityManager(), self, ob):
getSecurityManager(), self, ob):
return default return default
status = self._getStatusOf(ob) status = self._getStatusOf(ob)
variable_expression = vdef.getVariableExpression() variable_expression = vdef.getVariableExpression()
......
...@@ -470,8 +470,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -470,8 +470,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if name == self.getStateVariable(): if name == self.getStateVariable():
return self._getWorkflowStateOf(ob, 1) return self._getWorkflowStateOf(ob, 1)
vdef = self.getVariableValueDict()[name] vdef = self.getVariableValueDict()[name]
if vdef.getInfoGuard() is not None and not vdef.getInfoGuard().check( if not vdef.checkGuard(getSecurityManager(), self, ob):
getSecurityManager(), self, ob):
return default return default
status = self.getCurrentStatusDict(ob) status = self.getCurrentStatusDict(ob)
variable_expression = vdef.getVariableExpression() variable_expression = vdef.getVariableExpression()
......
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.Expression import Expression from Products.CMFCore.Expression import Expression
from Products.DCWorkflow.Guard import Guard
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.id_as_reference import IdAsReferenceMixin from Products.ERP5Type.id_as_reference import IdAsReferenceMixin
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Workflow.mixin.guardable import GuardableMixin
class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject,
GuardableMixin):
""" """
A ERP5 Workflow Variable. A ERP5 Workflow Variable.
""" """
...@@ -73,25 +74,3 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -73,25 +74,3 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
def getVariableExpressionText(self): def getVariableExpressionText(self):
return getattr(self.variable_expression, 'text', '') return getattr(self.variable_expression, 'text', '')
def getInfoGuard(self):
if self.getGuardRoleList() is None and\
self.getGuardPermissionList() is None and\
self.getGuardGroupList() is None and\
self.getGuardExpression() is None and\
self.info_guard is None:
return Guard().__of__(self)
elif self.info_guard is None:
self.generateInfoGuard()
return self.info_guard
def generateInfoGuard(self):
self.info_guard = Guard()
if self.getGuardRoleList() is not None:
self.info_guard.roles = self.getGuardRoleList()
if self.getGuardPermissionList() is not None:
self.info_guard.permissions = self.getGuardPermissionList()
if self.getGuardGroupList() is not None:
self.info_guard.groups = self.getGuardGroupList()
if self.getGuardExpression() is not None:
self.info_guard.expr = Expression(self.getGuardExpression())
...@@ -47,4 +47,5 @@ class WorklistVariable(WorkflowVariable): ...@@ -47,4 +47,5 @@ class WorklistVariable(WorkflowVariable):
PropertySheet.DublinCore, PropertySheet.DublinCore,
PropertySheet.Reference, PropertySheet.Reference,
PropertySheet.Variable, PropertySheet.Variable,
PropertySheet.Guard,
) )
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