Skip to content

Commit

Permalink
Fixed hellp tools permission checking
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmehedi committed Mar 25, 2024
1 parent c385ea3 commit 7229c44
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions includes/Rest/Help/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ],
],
]
Expand All @@ -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' ],
],
]
Expand All @@ -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' ],
],
]
Expand Down Expand Up @@ -111,8 +111,4 @@ public function disconnect_wemail() {
]
);
}

public function permission( $request ) {
return wemail()->user->can( 'view_wemail' );
}
}

0 comments on commit 7229c44

Please sign in to comment.