Commit 7bf42b1a authored by iv's avatar iv

ERP5Workflow: change getGuard(Role/Permission/Group) to getGuard...List

Adding List to the end of the getter of a given property will return
an instance of type list.
parent 29bb558d
...@@ -95,9 +95,9 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject): ...@@ -95,9 +95,9 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject):
return res return res
def getGuard(self): def getGuard(self):
if self.getGuardRole() is None and\ if self.getGuardRoleList() is None and\
self.getGuardPermission() is None and\ self.getGuardPermissionList() is None and\
self.getGuardGroup() is None and\ self.getGuardGroupList() is None and\
self.getGuardExpression() is None and\ self.getGuardExpression() is None and\
self.guard is None: self.guard is None:
return Guard().__of__(self) return Guard().__of__(self)
...@@ -107,11 +107,11 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject): ...@@ -107,11 +107,11 @@ class Interaction(IdAsReferenceMixin('interaction_', "prefix"), XMLObject):
def generateGuard(self): def generateGuard(self):
self.guard = Guard() self.guard = Guard()
if self.getGuardRole() is not None: if self.getGuardRoleList() is not None:
self.guard.roles = self.getGuardRole() self.guard.roles = self.getGuardRoleList()
if self.getGuardPermission() is not None: if self.getGuardPermissionList() is not None:
self.guard.permissions = self.getGuardPermission() self.guard.permissions = self.getGuardPermissionList()
if self.getGuardGroup() is not None: if self.getGuardGroupList() is not None:
self.guard.groups = self.getGuardGroup() self.guard.groups = self.getGuardGroupList()
if self.getGuardExpression() is not None: if self.getGuardExpression() is not None:
self.guard.expr = Expression(self.getGuardExpression()) self.guard.expr = Expression(self.getGuardExpression())
...@@ -100,11 +100,11 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject): ...@@ -100,11 +100,11 @@ class Transition(IdAsReferenceMixin("transition_", "prefix"), XMLObject):
def generateGuard(self): def generateGuard(self):
if self.guard is None: if self.guard is None:
self.guard = Guard() self.guard = Guard()
if self.getGuardRole() is not None: if self.getGuardRoleList() is not None:
self.guard.roles = self.getGuardRole() self.guard.roles = self.getGuardRoleList()
if self.getGuardPermission() is not None: if self.getGuardPermissionList() is not None:
self.guard.permissions = self.getGuardPermission() self.guard.permissions = self.getGuardPermissionList()
if self.getGuardGroup() is not None: if self.getGuardGroupList() is not None:
self.guard.groups = self.getGuardGroup() self.guard.groups = self.getGuardGroupList()
if self.getGuardExpression() is not None: if self.getGuardExpression() is not None:
self.guard.expr = Expression(self.getGuardExpression()) self.guard.expr = Expression(self.getGuardExpression())
...@@ -850,11 +850,11 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -850,11 +850,11 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
for property_id in sorted(transition_prop_id_to_show): for property_id in sorted(transition_prop_id_to_show):
if property_id in ('roles', 'groups', 'permissions', 'expr',): if property_id in ('roles', 'groups', 'permissions', 'expr',):
if property_id == 'roles': if property_id == 'roles':
property_value = tdef.getGuardRole() property_value = tdef.getGuardRoleList()
if property_id == 'groups': if property_id == 'groups':
property_value = tdef.getGuardGroup() property_value = tdef.getGuardGroupList()
if property_id == 'permissions': if property_id == 'permissions':
property_value = tdef.getGuardPermission() property_value = tdef.getGuardPermissionList()
if property_id == 'expr': if property_id == 'expr':
property_value = tdef.getGuardExpression() property_value = tdef.getGuardExpression()
if property_value is None or property_value == [] or property_value == (): if property_value is None or property_value == [] or property_value == ():
...@@ -949,11 +949,11 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -949,11 +949,11 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# show guard configuration: # show guard configuration:
if property_id in ('roles', 'groups', 'permissions', 'expr',): if property_id in ('roles', 'groups', 'permissions', 'expr',):
if property_id == 'roles': if property_id == 'roles':
property_value = qdef.getGuardRole() property_value = qdef.getGuardRoleList()
if property_id == 'groups': if property_id == 'groups':
property_value = qdef.getGuardGroup() property_value = qdef.getGuardGroupList()
if property_id == 'permissions': if property_id == 'permissions':
property_value = qdef.getGuardPermission() property_value = qdef.getGuardPermissionList()
if property_id == 'expr': if property_id == 'expr':
property_value = qdef.getGuardExpression() property_value = qdef.getGuardExpression()
if property_value is not None: if property_value is not None:
......
...@@ -72,9 +72,9 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -72,9 +72,9 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
return res return res
def getInfoGuard(self): def getInfoGuard(self):
if self.getGuardRole() is None and\ if self.getGuardRoleList() is None and\
self.getGuardPermission() is None and\ self.getGuardPermissionList() is None and\
self.getGuardGroup() is None and\ self.getGuardGroupList() is None and\
self.getGuardExpression() is None and\ self.getGuardExpression() is None and\
self.info_guard is None: self.info_guard is None:
return Guard().__of__(self) return Guard().__of__(self)
...@@ -84,11 +84,11 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -84,11 +84,11 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
def generateInfoGuard(self): def generateInfoGuard(self):
self.info_guard = Guard() self.info_guard = Guard()
if self.getGuardRole() is not None: if self.getGuardRoleList() is not None:
self.info_guard.roles = self.getGuardRole() self.info_guard.roles = self.getGuardRoleList()
if self.getGuardPermission() is not None: if self.getGuardPermissionList() is not None:
self.info_guard.permissions = self.getGuardPermission() self.info_guard.permissions = self.getGuardPermissionList()
if self.getGuardGroup() is not None: if self.getGuardGroupList() is not None:
self.info_guard.groups = self.getGuardGroup() self.info_guard.groups = self.getGuardGroupList()
if self.getGuardExpression() is not None: if self.getGuardExpression() is not None:
self.info_guard.expr = Expression(self.getGuardExpression()) self.info_guard.expr = Expression(self.getGuardExpression())
...@@ -85,9 +85,9 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -85,9 +85,9 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
return res return res
def getGuard(self): def getGuard(self):
if self.getGuardRole() is None and\ if self.getGuardRoleList() is None and\
self.getGuardPermission() is None and\ self.getGuardPermissionList() is None and\
self.getGuardGroup() is None and\ self.getGuardGroupList() is None and\
self.getGuardExpression() is None and\ self.getGuardExpression() is None and\
self.guard is None: self.guard is None:
return Guard().__of__(self) return Guard().__of__(self)
...@@ -97,12 +97,12 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject): ...@@ -97,12 +97,12 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
def generateGuard(self): def generateGuard(self):
self.guard = Guard() self.guard = Guard()
if self.getGuardRole() is not None: if self.getGuardRoleList() is not None:
self.guard.roles = self.getGuardRole() self.guard.roles = self.getGuardRoleList()
if self.getGuardPermission() is not None: if self.getGuardPermissionList() is not None:
self.guard.permissions = self.getGuardPermission() self.guard.permissions = self.getGuardPermissionList()
if self.getGuardGroup() is not None: if self.getGuardGroupList() is not None:
self.guard.groups = self.getGuardGroup() self.guard.groups = self.getGuardGroupList()
if self.getGuardExpression() is not None: if self.getGuardExpression() is not None:
self.guard.expr = Expression(self.getGuardExpression()) self.guard.expr = Expression(self.getGuardExpression())
......
...@@ -328,11 +328,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -328,11 +328,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
# configure guard # configure guard
if tdef.guard: if tdef.guard:
transition.guard = tdef.guard transition.guard = tdef.guard
transition.setRoleList(tdef.guard.roles) transition.setGuardRoleList(tdef.guard.roles)
transition.setPermissionList(tdef.guard.permissions) transition.setGuardPermissionList(tdef.guard.permissions)
transition.setGroupList(tdef.guard.groups) transition.setGuardGroupList(tdef.guard.groups)
if tdef.guard.expr is not None: if tdef.guard.expr is not None:
transition.setExpression(tdef.guard.expr.text) transition.setGuardExpression(tdef.guard.expr.text)
# create states (portal_type = State) # create states (portal_type = State)
for sid in dc_workflow.states: for sid in dc_workflow.states:
sdef = dc_workflow.states.get(sid) sdef = dc_workflow.states.get(sid)
...@@ -410,7 +410,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -410,7 +410,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
if isinstance(values, Expression): if isinstance(values, Expression):
worklist_variable_value.setVariableExpression(values.text) worklist_variable_value.setVariableExpression(values.text)
else: else:
worklist_variable_value.setVariableValue(values[0]) #to be changed? worklist_variable_value.setVariableValue(values[0]) #XXX(WORKFLOW): to be changed
worklist.setActboxUrl(qdef.actbox_url) worklist.setActboxUrl(qdef.actbox_url)
worklist.setActboxCategory(qdef.actbox_category) worklist.setActboxCategory(qdef.actbox_category)
...@@ -419,11 +419,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -419,11 +419,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
# configure guard # configure guard
if qdef.guard: if qdef.guard:
worklist.guard = qdef.guard worklist.guard = qdef.guard
worklist.setRoleList(qdef.guard.roles) worklist.setGuardRoleList(qdef.guard.roles)
worklist.setPermissionList(qdef.guard.permissions) worklist.setGuardPermissionList(qdef.guard.permissions)
worklist.setGroupList(qdef.guard.groups) worklist.setGuardGroupList(qdef.guard.groups)
if qdef.guard.expr is not None: if qdef.guard.expr is not None:
worklist.setExpression(qdef.guard.expr.text) worklist.setGuardExpression(qdef.guard.expr.text)
elif workflow_type_id == 'InteractionWorkflowDefinition': elif workflow_type_id == 'InteractionWorkflowDefinition':
dc_workflow_interaction_value_dict = dc_workflow.interactions dc_workflow_interaction_value_dict = dc_workflow.interactions
# create interactions (portal_type = Interaction) # create interactions (portal_type = Interaction)
...@@ -461,12 +461,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -461,12 +461,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
# configure guard # configure guard
if tdef.guard: if tdef.guard:
interaction.guard = tdef.guard interaction.guard = tdef.guard
interaction.setRoleList(tdef.guard.roles) interaction.setGuardRoleList(tdef.guard.roles)
interaction.setPermissionList(tdef.guard.permissions) interaction.setGuardPermissionList(tdef.guard.permissions)
interaction.setGroupList(tdef.guard.groups) interaction.setGuardGroupList(tdef.guard.groups)
if tdef.guard.expr is not None: if tdef.guard.expr is not None:
# Here add expression text, convert to expression in getMatchVar. # Here add expression text, convert to expression in getMatchVar.
interaction.setExpression(tdef.guard.expr.text) interaction.setGuardExpression(tdef.guard.expr.text)
interaction.setPortalTypeFilter(tdef.portal_type_filter) interaction.setPortalTypeFilter(tdef.portal_type_filter)
interaction.setPortalTypeGroupFilter(tdef.portal_type_group_filter) interaction.setPortalTypeGroupFilter(tdef.portal_type_group_filter)
if interaction.portal_type_filter == (): if interaction.portal_type_filter == ():
...@@ -510,12 +510,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -510,12 +510,12 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
variable.setVariableExpression(variable_definition.default_expr.text) variable.setVariableExpression(variable_definition.default_expr.text)
if variable_definition.info_guard: if variable_definition.info_guard:
variable.info_guard = variable_definition.info_guard variable.info_guard = variable_definition.info_guard
variable.setRoleList(variable_definition.info_guard.roles) variable.setGuardRoleList(variable_definition.info_guard.roles)
variable.setPermissionList(variable_definition.info_guard.permissions) variable.setGuardPermissionList(variable_definition.info_guard.permissions)
variable.setGroupList(variable_definition.info_guard.groups) variable.setGuardGroupList(variable_definition.info_guard.groups)
if variable_definition.info_guard.expr is not None: if variable_definition.info_guard.expr is not None:
# Here add expression text, convert to expression in getMatchVar. # Here add expression text, convert to expression in getMatchVar.
variable.setExpression(tdef.info_guard.expr.text) variable.setGuardExpression(tdef.info_guard.expr.text)
variable.setForCatalog(variable_definition.for_catalog) variable.setForCatalog(variable_definition.for_catalog)
variable.setStatusIncluded(variable_definition.for_status) variable.setStatusIncluded(variable_definition.for_status)
variable.setVariableValue(variable_definition.default_value) variable.setVariableValue(variable_definition.default_value)
...@@ -531,7 +531,6 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -531,7 +531,6 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
var_exprs = {} var_exprs = {}
else: var_exprs = origin_tdef.var_exprs else: var_exprs = origin_tdef.var_exprs
for key in var_exprs: for key in var_exprs:
#import pdb; pdb.set_trace()
tr_var = transition.newContent(portal_type='Transition Variable', temp_object=is_temporary) tr_var = transition.newContent(portal_type='Transition Variable', temp_object=is_temporary)
tr_var.setVariableExpression(var_exprs[key].text) tr_var.setVariableExpression(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath() tr_var_path = getattr(workflow, 'variable_'+key).getPath()
......
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