|
@@ 481-488 (lines=8) @@
|
| 478 |
|
* |
| 479 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 480 |
|
*/ |
| 481 |
|
public static function connect_url_permission_callback() { |
| 482 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 483 |
|
return true; |
| 484 |
|
} |
| 485 |
|
|
| 486 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 487 |
|
|
| 488 |
|
} |
| 489 |
|
|
| 490 |
|
/** |
| 491 |
|
* Verify that a user can get the data about the current user. |
|
@@ 500-506 (lines=7) @@
|
| 497 |
|
* |
| 498 |
|
* @return bool|WP_Error True if user is able to unlink. |
| 499 |
|
*/ |
| 500 |
|
public static function get_user_connection_data_permission_callback() { |
| 501 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 502 |
|
return true; |
| 503 |
|
} |
| 504 |
|
|
| 505 |
|
return new WP_Error( 'invalid_user_permission_user_connection_data', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 506 |
|
} |
| 507 |
|
|
| 508 |
|
/** |
| 509 |
|
* Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked. |