From 7229c44d67c5bb268f7e461f7df3310a96e9c8f8 Mon Sep 17 00:00:00 2001 From: bdmehedi Date: Mon, 25 Mar 2024 08:54:44 +0600 Subject: [PATCH] Fixed hellp tools permission checking --- includes/Rest/Help/Help.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/Rest/Help/Help.php b/includes/Rest/Help/Help.php index 8eb7b1a..ef027f4 100644 --- a/includes/Rest/Help/Help.php +++ b/includes/Rest/Help/Help.php @@ -19,7 +19,7 @@ public function register_routes() { [ [ 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], + 'permission_callback' => [ $this, 'can_view_wemail' ], 'callback' => [ $this, 'index' ], ], ] @@ -31,7 +31,7 @@ public function register_routes() { [ [ 'methods' => WP_REST_Server::CREATABLE, - 'permission_callback' => [ $this, 'permission' ], + 'permission_callback' => [ $this, 'can_view_wemail' ], 'callback' => [ $this, 'send_ping' ], ], ] @@ -43,7 +43,7 @@ public function register_routes() { [ [ 'methods' => WP_REST_Server::CREATABLE, - 'permission_callback' => [ $this, 'permission' ], + 'permission_callback' => [ $this, 'can_view_wemail' ], 'callback' => [ $this, 'receive_ping' ], ], ] @@ -111,8 +111,4 @@ public function disconnect_wemail() { ] ); } - - public function permission( $request ) { - return wemail()->user->can( 'view_wemail' ); - } }