Code Duplication    Length = 7-8 lines in 3 locations

_inc/lib/class.core-rest-api-endpoints.php 3 locations

@@ 694-701 (lines=8) @@
691
	 *
692
	 * @return bool|WP_Error True if user is able to disconnect the site.
693
	 */
694
	public static function disconnect_site_permission_callback() {
695
		if ( current_user_can( 'jetpack_disconnect' ) ) {
696
			return true;
697
		}
698
699
		return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
700
701
	}
702
703
	/**
704
	 * Verify that the user can get a connect/link URL
@@ 745-751 (lines=7) @@
742
	 *
743
	 * @return bool|WP_Error True if user is able to change master user.
744
	 */
745
	public static function set_connection_owner_permission_callback() {
746
		if ( current_user_can( 'jetpack_disconnect' ) ) {
747
			return true;
748
		}
749
750
		return new WP_Error( 'invalid_user_permission_set_connection_owner', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
751
	}
752
753
	/**
754
	 * Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked.
@@ 822-828 (lines=7) @@
819
	 *
820
	 * @return bool Whether user has capability 'jetpack_disconnect'.
821
	 */
822
	public static function identity_crisis_mitigation_permission_check() {
823
		if ( current_user_can( 'jetpack_disconnect' ) ) {
824
			return true;
825
		}
826
827
		return new WP_Error( 'invalid_user_permission_identity_crisis', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
828
	}
829
830
	/**
831
	 * Verify that user can update Jetpack general settings.