Skip to content

Commit

Permalink
FollowingEndpoint: change permission check (#34366)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyweight authored Nov 29, 2023
1 parent b5e868c commit c495cf2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function register_routes() {
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_following' ),
'permission_callback' => array( $this, 'permission_check' ),
'permission_callback' => 'is_user_logged_in',
'args' => array(
'ignore_user_blogs' => array(
'type' => 'boolean',
Expand All @@ -65,7 +65,7 @@ public function register_routes() {
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_recommendations' ),
'permission_callback' => array( $this, 'permission_check' ),
'permission_callback' => 'is_user_logged_in',
'args' => array(
'number' => array(
'type' => 'number',
Expand All @@ -80,15 +80,6 @@ public function register_routes() {
);
}

/**
* Check if user has edit post permission.
*
* @return true|WP_Error True if the request has access to create items, WP_Error object otherwise.
*/
public function permission_check() {
return current_user_can( 'edit_posts' );
}

/**
* Gets the sites the user is following
*
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-following-api-perm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix


0 comments on commit c495cf2

Please sign in to comment.