Add support for guards

Created on 31 October 2023, 8 months ago

Problem/Motivation

We are using State Machine to provide buttons on entities to move them to different states. We want to be able to hide these buttons if the state transition should not be allowed -- for example, some fields are not currently set on a node, or a user needs a certain role to do the state transition.

Steps to reproduce

1. Create a state machine workflow, and add it to a content type.
2. Create an ECA to move a node through a workflow.
3. Set the state machine field to "transition form" on a display.
4. See that anybody with permission to update the node can see all transition buttons.

Proposed resolution

Add an event, "Evaluate a State Machine Guard" or similar, to handle these.

Remaining tasks

The end result of evaluating a guard should be a boolean return code. I'm not sure how best to model this -- maybe make an action for returning the guard state?

Also seems worthwhile to support an exception workflow, to have the event handler return false if any following action throws an exception, or return true if not?

User interface changes

New ECA event and possibly action.

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024