PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.6
JetFormBuilder — Dynamic Blocks Form Builder v3.6.6
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 134 releases
← All changes | modules/rest-api/endpoints/get-form-fields.php +6 -2 3.6.2 → 3.6.6 View file →
@@ -9,8 +9,9 @@
9 9 use Jet_Form_Builder\Form_Manager;
10 10 use Jet_Form_Builder\Request\Exceptions\Plain_Value_Exception;
11 11 use JFB_Components\Rest_Api\Rest_Api_Endpoint_Base;
12 12 use JFB_Modules\Block_Parsers\Field_Data_Parser;
13 +use Jet_Form_Builder\Admin\Tabs_Handlers\Tab_Handler_Manager;
13 14
14 15 // If this file is called directly, abort.
15 16 if ( ! defined( 'WPINC' ) ) {
16 17 die;
@@ -35,16 +36,19 @@
35 36 );
36 37 }
37 38
38 39 public function check_permission(): bool {
39 - return current_user_can( 'edit_jet_fb_forms' );
40 + $capability = Tab_Handler_Manager::get_form_records_access_capability();
41 + return current_user_can( 'edit_jet_fb_forms' ) || current_user_can( $capability );
40 42 }
41 43
42 44 public function run_callback( \WP_REST_Request $request ) {
43 45 $form_id = $request->get_param( 'id' );
44 46 $form = get_post( $form_id );
47 + $capability = Tab_Handler_Manager::get_form_records_access_capability();
45 48
46 - if ( absint( $form->post_author ) !== get_current_user_id()
49 + if ( ! current_user_can( $capability )
50 + && absint( $form->post_author ) !== get_current_user_id()
47 51 && ! current_user_can( 'edit_post', $form->ID )
48 52 ) {
49 53 return new \WP_REST_Response(
50 54 array(