From 9883a261c9c4db0ba54c484ce57784a60903a92d Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Thu, 2 Mar 2023 15:10:22 +0100 Subject: [PATCH] Forms: fix permission check in Responses endpoint (#29223) --- .../forms/changelog/fix-forms-endpoint-permissions | 4 ++++ .../forms/src/class-wpcom-rest-api-v2-endpoint-forms.php | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 projects/packages/forms/changelog/fix-forms-endpoint-permissions diff --git a/projects/packages/forms/changelog/fix-forms-endpoint-permissions b/projects/packages/forms/changelog/fix-forms-endpoint-permissions new file mode 100644 index 0000000000000..18c9b7335aa2e --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-endpoint-permissions @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Forms Responses endpoint: fix permission check. diff --git a/projects/packages/forms/src/class-wpcom-rest-api-v2-endpoint-forms.php b/projects/packages/forms/src/class-wpcom-rest-api-v2-endpoint-forms.php index df8693e9369b2..67869ab747996 100644 --- a/projects/packages/forms/src/class-wpcom-rest-api-v2-endpoint-forms.php +++ b/projects/packages/forms/src/class-wpcom-rest-api-v2-endpoint-forms.php @@ -39,10 +39,10 @@ public function register_rest_routes() { $this->namespace, $this->rest_base . '/responses', array( - 'methods' => WP_REST_Server::READABLE, - 'callback' => array( $this, 'get_responses' ), - 'permissions_check' => array( $this, 'get_responses_permission_check' ), - 'args' => array( + 'methods' => WP_REST_Server::READABLE, + 'callback' => array( $this, 'get_responses' ), + 'permission_callback' => array( $this, 'get_responses_permission_check' ), + 'args' => array( 'limit' => array( 'default' => 20, 'type' => 'integer',