|
@@ 240-247 (lines=8) @@
|
| 237 |
|
* |
| 238 |
|
* @return bool|WP_Error True if user is able to disconnect the site. |
| 239 |
|
*/ |
| 240 |
|
public static function connect_url_permission_callback() { |
| 241 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 242 |
|
return true; |
| 243 |
|
} |
| 244 |
|
|
| 245 |
|
return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 246 |
|
|
| 247 |
|
} |
| 248 |
|
|
| 249 |
|
/** |
| 250 |
|
* Verify that a user can use the link endpoint. |
|
@@ 256-262 (lines=7) @@
|
| 253 |
|
* |
| 254 |
|
* @return bool|WP_Error True if user is able to link to WordPress.com |
| 255 |
|
*/ |
| 256 |
|
public static function link_user_permission_callback() { |
| 257 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 258 |
|
return true; |
| 259 |
|
} |
| 260 |
|
|
| 261 |
|
return new WP_Error( 'invalid_user_permission_link_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 262 |
|
} |
| 263 |
|
|
| 264 |
|
/** |
| 265 |
|
* Verify that a user can get the data about the current user. |
|
@@ 274-280 (lines=7) @@
|
| 271 |
|
* |
| 272 |
|
* @return bool|WP_Error True if user is able to unlink. |
| 273 |
|
*/ |
| 274 |
|
public static function get_user_connection_data_permission_callback() { |
| 275 |
|
if ( current_user_can( 'jetpack_connect_user' ) ) { |
| 276 |
|
return true; |
| 277 |
|
} |
| 278 |
|
|
| 279 |
|
return new WP_Error( 'invalid_user_permission_unlink_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) ); |
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
/** |
| 283 |
|
* Verify that a user can use the unlink endpoint. |