|
@@ 862-869 (lines=8) @@
|
| 859 |
|
* |
| 860 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 861 |
|
*/ |
| 862 |
|
public static function disconnect_site_permission_callback() { |
| 863 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 864 |
|
return true; |
| 865 |
|
} |
| 866 |
|
|
| 867 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 868 |
|
|
| 869 |
|
} |
| 870 |
|
|
| 871 |
|
/** |
| 872 |
|
* Verify that the user can get a connect/link URL |
|
@@ 913-919 (lines=7) @@
|
| 910 |
|
* |
| 911 |
|
* @return bool|WP_Error True if user is able to change master user. |
| 912 |
|
*/ |
| 913 |
|
public static function set_connection_owner_permission_callback() { |
| 914 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 915 |
|
return true; |
| 916 |
|
} |
| 917 |
|
|
| 918 |
|
return new WP_Error( 'invalid_user_permission_set_connection_owner', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 919 |
|
} |
| 920 |
|
|
| 921 |
|
/** |
| 922 |
|
* Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked. |
|
@@ 990-996 (lines=7) @@
|
| 987 |
|
* |
| 988 |
|
* @return bool Whether user has capability 'jetpack_disconnect'. |
| 989 |
|
*/ |
| 990 |
|
public static function identity_crisis_mitigation_permission_check() { |
| 991 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 992 |
|
return true; |
| 993 |
|
} |
| 994 |
|
|
| 995 |
|
return new WP_Error( 'invalid_user_permission_identity_crisis', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 996 |
|
} |
| 997 |
|
|
| 998 |
|
/** |
| 999 |
|
* Verify that user can update Jetpack general settings. |