projects/packages/backup/src/class-rest-controller.php 1 location
|
@@ 73-84 (lines=12) @@
|
| 70 |
|
* |
| 71 |
|
* @return bool|WP_Error True if a blog token was used to sign the request, WP_Error otherwise. |
| 72 |
|
*/ |
| 73 |
|
public static function backup_helper_script_permissions_callback() { |
| 74 |
|
if ( Rest_Authentication::is_signed_with_blog_token() ) { |
| 75 |
|
return true; |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
$error_msg = esc_html__( |
| 79 |
|
'You are not allowed to perform this action.', |
| 80 |
|
'jetpack' |
| 81 |
|
); |
| 82 |
|
|
| 83 |
|
return new WP_Error( 'rest_forbidden', $error_msg, array( 'status' => rest_authorization_required_code() ) ); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
/** |
| 87 |
|
* Install the Backup Helper Script. |
projects/packages/sync/src/class-rest-endpoints.php 1 location
|
@@ 711-723 (lines=13) @@
|
| 708 |
|
* |
| 709 |
|
* @return bool Whether user has capability 'manage_options' or a blog token is used. |
| 710 |
|
*/ |
| 711 |
|
public static function verify_default_permissions() { |
| 712 |
|
if ( current_user_can( 'manage_options' ) || Rest_Authentication::is_signed_with_blog_token() ) { |
| 713 |
|
return true; |
| 714 |
|
} |
| 715 |
|
|
| 716 |
|
$error_msg = esc_html__( |
| 717 |
|
'You do not have the correct user permissions to perform this action. |
| 718 |
|
Please contact your site admin if you think this is a mistake.', |
| 719 |
|
'jetpack' |
| 720 |
|
); |
| 721 |
|
|
| 722 |
|
return new WP_Error( 'invalid_user_permission_sync', $error_msg, array( 'status' => rest_authorization_required_code() ) ); |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
/** |
| 726 |
|
* Validate Queue name. |