|
@@ 322-329 (lines=8) @@
|
| 319 |
|
* |
| 320 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 321 |
|
*/ |
| 322 |
|
public static function connect_url_permission_callback() { |
| 323 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 324 |
|
return true; |
| 325 |
|
} |
| 326 |
|
|
| 327 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 328 |
|
|
| 329 |
|
} |
| 330 |
|
|
| 331 |
|
/** |
| 332 |
|
* Verify that a user can use the link endpoint. |
|
@@ 338-344 (lines=7) @@
|
| 335 |
|
* |
| 336 |
|
* @return bool|WP_Error True if user is able to link to WordPress.com |
| 337 |
|
*/ |
| 338 |
|
public static function link_user_permission_callback() { |
| 339 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 340 |
|
return true; |
| 341 |
|
} |
| 342 |
|
|
| 343 |
|
return new WP_Error( 'invalid_user_permission_link_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 344 |
|
} |
| 345 |
|
|
| 346 |
|
/** |
| 347 |
|
* Verify that a user can get the data about the current user. |
|
@@ 356-362 (lines=7) @@
|
| 353 |
|
* |
| 354 |
|
* @return bool|WP_Error True if user is able to unlink. |
| 355 |
|
*/ |
| 356 |
|
public static function get_user_connection_data_permission_callback() { |
| 357 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 358 |
|
return true; |
| 359 |
|
} |
| 360 |
|
|
| 361 |
|
return new WP_Error( 'invalid_user_permission_unlink_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 362 |
|
} |
| 363 |
|
|
| 364 |
|
/** |
| 365 |
|
* Verify that a user can use the unlink endpoint. |