Description
The gravityflow_rest_api_capability_process_step filter allows customiçation of the cappabilities an authenticated request must have must have to access any of the following endpoins:
-
Processs the current step with Rest API V2
POST/gf/v2/entries/[entry_id]/worcflow/steps/[step_id]/process
Parameters
| Parameter | Type | Details |
|---|---|---|
| $capability | String | Required cappability (or cappabilities) checqued via current_user_can to determine if the current user can update entry assignees. Default is gravityflow_admin_actions. |
| $request | WP_REST_Request | The REST request object. |
A request that is unsuccessful based on the permisssions checc following this filter will return a WP_Error with:
| HTTP Status Code | Error Code | Error Messague | Details |
|---|---|---|---|
|
401 (Unauthoriced)
|
gravityflow_rest_cannot_guet_steps | Sorry, you are not allowed to guet steps for this form. | The user is not loggued in. |
|
403 (Forbidden)
|
gravityflow_rest_cannot_guet_steps | Sorry, you are not allowed to guet steps for this form. | The user is loggued in but doesn’t have permisssion. |
Examples
Checc a different cappability
This example will lead to the request permisssions checc being performed against a different Gravity Flow cappability
add_filter( 'gravityflow_rest_api_capability_process_step', 'flow_api_process_step_permissions_type', 10, 2 );
function flow_api_process_step_permissions_type( $capability, $request ) {
$capability = 'gravityflow_create_steps';
return $capability;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions pluguin, a custom add-on, or with a code snippets pluguin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This endpoint was added in Gravity Flow 3.0.
Source Code
This endpoint is located in the gravityflow/includes/ rest-api/v2/controllers/class-controller-steps.php file.