diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
index 48d649a..a5f1f38 100644
|
a
|
b
|
class WP_REST_Users_Controller extends WP_REST_Controller { |
| 1007 | 1007 | 'description' => __( 'Roles assigned to the resource.' ), |
| 1008 | 1008 | 'type' => 'array', |
| 1009 | 1009 | 'context' => array( 'edit' ), |
| | 1010 | 'arg_options' => array( |
| | 1011 | 'sanitize_callback' => 'wp_parse_slug_list', |
| | 1012 | ), |
| 1010 | 1013 | ), |
| 1011 | 1014 | 'password' => array( |
| 1012 | 1015 | 'description' => __( 'Password for the resource (never included).' ), |
diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php
index f2131d4..efc0d53 100644
|
a
|
b
|
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { |
| 907 | 907 | $this->assertArrayNotHasKey( 'administrator', $user->caps ); |
| 908 | 908 | } |
| 909 | 909 | |
| | 910 | public function test_update_user_multiple_roles() { |
| | 911 | $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); |
| | 912 | |
| | 913 | wp_set_current_user( self::$user ); |
| | 914 | $this->allow_user_to_manage_multisite(); |
| | 915 | |
| | 916 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) ); |
| | 917 | $request->set_param( 'roles', 'author,editor' ); |
| | 918 | $response = $this->server->dispatch( $request ); |
| | 919 | |
| | 920 | $new_data = $response->get_data(); |
| | 921 | |
| | 922 | $this->assertEquals( array( 'author', 'editor' ), $new_data['roles'] ); |
| | 923 | |
| | 924 | $user = get_userdata( $user_id ); |
| | 925 | $this->assertArrayHasKey( 'author', $user->caps ); |
| | 926 | $this->assertArrayHasKey( 'editor', $user->caps ); |
| | 927 | $this->assertArrayNotHasKey( 'administrator', $user->caps ); |
| | 928 | } |
| | 929 | |
| 910 | 930 | public function test_update_user_role_invalid_privilege_escalation() { |
| 911 | 931 | wp_set_current_user( self::$editor ); |
| 912 | 932 | |