|
@@ 904-911 (lines=8) @@
|
| 901 |
|
* |
| 902 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 903 |
|
*/ |
| 904 |
|
public static function disconnect_site_permission_callback() { |
| 905 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 906 |
|
return true; |
| 907 |
|
} |
| 908 |
|
|
| 909 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 910 |
|
|
| 911 |
|
} |
| 912 |
|
|
| 913 |
|
/** |
| 914 |
|
* Verify that the user can get a connect/link URL |
|
@@ 955-961 (lines=7) @@
|
| 952 |
|
* |
| 953 |
|
* @return bool|WP_Error True if user is able to change master user. |
| 954 |
|
*/ |
| 955 |
|
public static function set_connection_owner_permission_callback() { |
| 956 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 957 |
|
return true; |
| 958 |
|
} |
| 959 |
|
|
| 960 |
|
return new WP_Error( 'invalid_user_permission_set_connection_owner', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 961 |
|
} |
| 962 |
|
|
| 963 |
|
/** |
| 964 |
|
* Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked. |
|
@@ 1032-1038 (lines=7) @@
|
| 1029 |
|
* |
| 1030 |
|
* @return bool Whether user has capability 'jetpack_disconnect'. |
| 1031 |
|
*/ |
| 1032 |
|
public static function identity_crisis_mitigation_permission_check() { |
| 1033 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 1034 |
|
return true; |
| 1035 |
|
} |
| 1036 |
|
|
| 1037 |
|
return new WP_Error( 'invalid_user_permission_identity_crisis', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 1038 |
|
} |
| 1039 |
|
|
| 1040 |
|
/** |
| 1041 |
|
* Verify that user can update Jetpack general settings. |