Skip to content

Commit

Permalink
Licensing: Update permissions check to rely on manage_options
Browse files Browse the repository at this point in the history
  • Loading branch information
ebinnion committed Mar 30, 2022
1 parent ab02920 commit 79e4fc7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions projects/packages/licensing/src/class-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public function register_endpoints() {
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => __CLASS__ . '::get_licensing_error',
'permission_callback' => __CLASS__ . '::view_admin_page_permission_check',
'permission_callback' => __CLASS__ . '::can_manage_options_check',
),
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => __CLASS__ . '::update_licensing_error',
'permission_callback' => __CLASS__ . '::view_admin_page_permission_check',
'permission_callback' => __CLASS__ . '::can_manage_options_check',
'args' => array(
'error' => array(
'required' => true,
Expand Down Expand Up @@ -191,14 +191,14 @@ public static function user_licensing_permission_check() {
}

/**
* Verify that user can view Jetpack admin page.
* Verify that user can manage_options
*
* @since 4.3.0
* @since $$next-version$$
*
* @return bool Whether user has the capability 'jetpack_admin_page'.
* @return bool Whether user has the capability 'manage_options'.
*/
public static function view_admin_page_permission_check() {
if ( current_user_can( 'jetpack_admin_page' ) ) {
public static function can_manage_options_check() {
if ( current_user_can( 'manage_options' ) ) {
return true;
}

Expand Down

0 comments on commit 79e4fc7

Please sign in to comment.