class WorkflowDeleteAccessCheck extends WorkflowStateTransitionOperationsAccessCheck (View source)

internal  Marked as internal for use by the workflows module only. This is deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use _workflow_access in route definitions instead. @code # The old approach: requirements: _workflow_state_delete_access: 'true' # The new approach: requirements: _workflow_access: 'delete-state' @endcode As an internal API the ability to use _workflow_state_delete_access may also be removed in a minor release.
 

Provides a access checker for deleting a workflow state.

Methods

access(RouteMatchInterface $route_match, AccountInterface $account)

Checks access for operations of workflow states and transitions.

string
getOperation(RouteMatchInterface $route_match)

Get the operation that will be used for the access check

Details

AccessResultInterface access(RouteMatchInterface $route_match, AccountInterface $account)

Checks access for operations of workflow states and transitions.

The value of '_workflow_access' is used to check to kind of access that should be applied to a route in the context of a workflow and a state or transition. States and transitions can individually have access control applied to them for 'add', 'update' and 'delete'. By default workflows will use the admin permission 'administer workflows' for all of these operations, except for delete-state which checks there is at least one state, a state does not have data and it's not a required state.

For the update and delete operations, a workflow and a state or transition is required in the route for the access check to be applied. For the "add" operation, only a workflow is required. The '_workflow_access' requirement translates into access checks on the workflow entity type in the formats:

  • @code"$operation-state:$state_id"@endcode
  • @code"$operation-transition:$transition_id"@endcode

For example the following route definition with the path "/test-workflow/foo-state/delete" the 'delete-state:foo-state' operation will be checked:

Parameters

RouteMatchInterface $route_match

The parametrized route

AccountInterface $account

The currently logged in account.

Return Value

AccessResultInterface

An access result.

Exceptions

Exception

protected string getOperation(RouteMatchInterface $route_match)

Get the operation that will be used for the access check

Parameters

RouteMatchInterface $route_match

The parametrized route

Return Value

string

The access operation.