flows: fix incorrect diagram for policies bound to flows

closes #3534

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-09-06 10:24:10 +02:00
parent 34e71351a6
commit 2a4679e390
1 changed files with 10 additions and 5 deletions

View File

@ -277,6 +277,11 @@ class FlowViewSet(UsedByMixin, ModelViewSet):
if element.type == "condition": if element.type == "condition":
# Policy passes, link policy yes to next stage # Policy passes, link policy yes to next stage
footer.append(f"{element.identifier}(yes, right)->{body[index + 1].identifier}") footer.append(f"{element.identifier}(yes, right)->{body[index + 1].identifier}")
# For policies bound to the flow itself, if they deny,
# the flow doesn't get executed, hence directly to the end
if element.identifier.startswith("flow_policy_"):
footer.append(f"{element.identifier}(no, bottom)->e")
else:
# Policy doesn't pass, go to stage after next stage # Policy doesn't pass, go to stage after next stage
no_element = body[index + 1] no_element = body[index + 1]
if no_element.type != "end": if no_element.type != "end":