Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Commit 9fc8248

Browse files
1 parent 5a87f9d commit 9fc8248

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

lib/endpoints/class-wp-rest-users-controller.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,6 @@ public function get_item_schema() {
752752
'description' => __( 'Roles assigned to the resource.' ),
753753
'type' => 'array',
754754
'context' => array( 'edit' ),
755-
'enum' => array_keys( $wp_roles->role_objects ),
756755
),
757756
'capabilities' => array(
758757
'description' => __( 'All capabilities assigned to the resource.' ),

plugin.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,6 @@ function rest_validate_request_arg( $value, $request, $param ) {
292292
if ( 'string' === $args['type'] && ! in_array( $value, $args['enum'] ) ) {
293293
return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not one of %s' ), $param, implode( ', ', $args['enum'] ) ) );
294294
}
295-
if ( 'array' === $args['type'] && array_diff( $value, $args['enum'] ) ) {
296-
return new WP_Error( 'rest_invalid_param', sprintf( __( '%s includes a value not in %s' ), $param, implode( ', ', $args['enum'] ) ) );
297-
}
298295
}
299296

300297
if ( 'integer' === $args['type'] && ! is_numeric( $value ) ) {

tests/test-rest-users-controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ public function test_create_user_invalid_role() {
567567
$request->set_body_params( $params );
568568
$response = $this->server->dispatch( $request );
569569

570-
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
570+
$this->assertErrorResponse( 'rest_user_invalid_role', $response, 400 );
571571
}
572572

573573
public function test_update_item() {
@@ -772,7 +772,7 @@ public function test_update_user_role_invalid_role() {
772772
$request->set_param( 'roles', array( 'BeSharp' ) );
773773
$response = $this->server->dispatch( $request );
774774

775-
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
775+
$this->assertErrorResponse( 'rest_user_invalid_role', $response, 400 );
776776

777777
$user = get_userdata( $this->editor );
778778
$this->assertArrayHasKey( 'editor', $user->caps );

0 commit comments

Comments
 (0)