Description
The gravityflow_rest_api_capability_get_forms_steps filter allows customization of the capabilities an authenticated request must have to access any of the following endpoints:
- Get Steps By Form with Rest API v2
GET /wp-json/gravityflow/v2/forms/[form_id]/workflow/steps - Get Steps By Entry with Rest API v2
GET/wp-json/gravityflow/v2/entries/[entry_id]/workflow/steps - Get Specific Step with Rest API v2
GET/wp-json/gravityflow/v2/entries/[entry_id]/workflow/steps
Parameters
| Parameter | Type | Details |
|---|---|---|
| $capability | String | Required capability (or capabilities) checked via current_user_can to determine if the current user can view entry assignees. Default is gravityflow_create_steps. |
| $request | WP_REST_Request | The REST request object. |
A request that is unsuccessful based on the permissions check following this filter will return a WP_Error with:
| HTTP Status Code | Error Code | Error Message | Details |
|---|---|---|---|
| 401 (Unauthorized) | gravityflow_rest_cannot_get_steps | Sorry, you are not allowed to get steps for this form. | The user is not logged in. |
| 403 (Forbidden) | gravityflow_rest_cannot_get_steps | Sorry, you are not allowed to get steps for this form. | The user is logged in but doesn’t have permission. |
Examples
Check a different capability
This example will lead to the request permissions check being performed against a different Gravity Flow capability
add_filter( 'gravityflow_rest_api_capability_get_forms_steps', 'flow_capability_form_steps_type', 10, 2 );
function flow_capability_form_steps_type( $capability, $request ) {
$capability = 'gravityflow_settings';
return $capability;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
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.