Commit 84a5644f authored by iv's avatar iv

ERP5Workflow: fix typo (forgotten 'not') + add isGuarded method

parent 8a136576
......@@ -350,10 +350,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
workflow_title = self.getTitle()
for worklist_value in self.getWorklistValueList():
action_box_name = worklist_value.getActionName()
is_guarded = (worklist_value.getGuardRoleList() or
worklist_value.getGuardGroupList() or
worklist_value.getGuardPermissionList() or
worklist_value.getGuardExpression().text)
is_guarded = worklist_value.isGuarded()
guard_role_list = worklist_value.getGuardRoleList()
if action_box_name:
variable_match = {}
......@@ -380,9 +377,11 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
continue
is_permitted_worklist = 0
if is_guarded:
if not is_guarded:
is_permitted_worklist = 1
elif (not check_guard or worklist_value.checkGuard(security_manager, self, portal, check_roles=False)):
elif not check_guard or worklist_value.checkGuard(security_manager,
self, portal,
check_roles=False):
is_permitted_worklist = 1
variable_match[SECURITY_PARAMETER_ID] = guard_role_list
......
......@@ -30,6 +30,10 @@ class GuardableMixin(object):
security = ClassSecurityInfo()
security.declareObjectProtected(ManagePortal)
def isGuarded(self):
return self.guard_expression and self.guard_group and \
self.guard_permission and guard_role
def checkGuard(self, security_manager, workflow, current_object, check_roles=True, **kw):
"""Checks conditions in this 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