|
@@ 294-301 (lines=8) @@
|
| 291 |
|
* |
| 292 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 293 |
|
*/ |
| 294 |
|
public static function connect_url_permission_callback() { |
| 295 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 296 |
|
return true; |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 300 |
|
|
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
/** |
| 304 |
|
* Verify that a user can use the link endpoint. |
|
@@ 310-316 (lines=7) @@
|
| 307 |
|
* |
| 308 |
|
* @return bool|WP_Error True if user is able to link to WordPress.com |
| 309 |
|
*/ |
| 310 |
|
public static function link_user_permission_callback() { |
| 311 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 312 |
|
return true; |
| 313 |
|
} |
| 314 |
|
|
| 315 |
|
return new WP_Error( 'invalid_user_permission_link_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
/** |
| 319 |
|
* Verify that a user can get the data about the current user. |
|
@@ 328-334 (lines=7) @@
|
| 325 |
|
* |
| 326 |
|
* @return bool|WP_Error True if user is able to unlink. |
| 327 |
|
*/ |
| 328 |
|
public static function get_user_connection_data_permission_callback() { |
| 329 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 330 |
|
return true; |
| 331 |
|
} |
| 332 |
|
|
| 333 |
|
return new WP_Error( 'invalid_user_permission_unlink_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 334 |
|
} |
| 335 |
|
|
| 336 |
|
/** |
| 337 |
|
* Verify that a user can use the unlink endpoint. |