|
@@ 777-784 (lines=8) @@
|
| 774 |
|
* |
| 775 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 776 |
|
*/ |
| 777 |
|
public static function disconnect_site_permission_callback() { |
| 778 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 779 |
|
return true; |
| 780 |
|
} |
| 781 |
|
|
| 782 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 783 |
|
|
| 784 |
|
} |
| 785 |
|
|
| 786 |
|
/** |
| 787 |
|
* Verify that the user can get a connect/link URL |
|
@@ 828-834 (lines=7) @@
|
| 825 |
|
* |
| 826 |
|
* @return bool|WP_Error True if user is able to change master user. |
| 827 |
|
*/ |
| 828 |
|
public static function set_connection_owner_permission_callback() { |
| 829 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 830 |
|
return true; |
| 831 |
|
} |
| 832 |
|
|
| 833 |
|
return new WP_Error( 'invalid_user_permission_set_connection_owner', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 834 |
|
} |
| 835 |
|
|
| 836 |
|
/** |
| 837 |
|
* Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked. |
|
@@ 905-911 (lines=7) @@
|
| 902 |
|
* |
| 903 |
|
* @return bool Whether user has capability 'jetpack_disconnect'. |
| 904 |
|
*/ |
| 905 |
|
public static function identity_crisis_mitigation_permission_check() { |
| 906 |
|
if ( current_user_can( 'jetpack_disconnect' ) ) { |
| 907 |
|
return true; |
| 908 |
|
} |
| 909 |
|
|
| 910 |
|
return new WP_Error( 'invalid_user_permission_identity_crisis', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 911 |
|
} |
| 912 |
|
|
| 913 |
|
/** |
| 914 |
|
* Verify that user can update Jetpack general settings. |