Description
The gravityflowincomingwebhook_check_permissions filter allows developers to override or extend the permission logic for incoming webhook REST API requests in the Gravity Flow Incoming Webhook extension.
Usage
1 | add_filter( 'gravityflowincomingwebhook_check_permissions' , 'your_function_name' , 10, 2 ); |
Parameters
Parameter | Type | Details |
---|---|---|
$has_permission | bool|null | The result of the permission check. Return true to allow, false to deny, or null to use default logic. |
$request | WP_REST_Request | The current REST API request object. |
Examples
Restrict the value of desig (designation) to manager, admin and employee.
1 2 3 4 5 6 7 8 9 10 11 | add_filter( 'gravityflowincomingwebhook_check_permissions' , 'sb_gravityflowincomingwebhook_check_permissions' , 10, 2 ); function sb_gravityflowincomingwebhook_check_permissions( $has_permission , $request ) { $valid_designations = [ 'manager' , 'admin' , 'employee' ]; $desig = $request ->get_param( 'desig' ); if ( !in_array( $desig , $valid_designations ) ) { $has_permission = false; } return $has_permission ; } |
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?
Source Code
This filter is located in gravityflowincomingwebhook/class-incoming-webhook.php