REST API: Limit search_columns for users without list_users.

Props Vortfu, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis.
Reviewed by jorbin, audrasjb.




Built from https://develop.svn.wordpress.org/branches/6.3@56840


git-svn-id: http://core.svn.wordpress.org/branches/6.3@56352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-10-12 13:10:26 +00:00
parent 638bbbf0a4
commit 0be4374921
2 changed files with 4 additions and 1 deletions

View File

@ -318,6 +318,9 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
} }
if ( ! empty( $prepared_args['search'] ) ) { if ( ! empty( $prepared_args['search'] ) ) {
if ( ! current_user_can( 'list_users' ) ) {
$prepared_args['search_columns'] = array( 'ID', 'user_login', 'user_nicename', 'display_name' );
}
$prepared_args['search'] = '*' . $prepared_args['search'] . '*'; $prepared_args['search'] = '*' . $prepared_args['search'] . '*';
} }
/** /**

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3.2-RC1-56795'; $wp_version = '6.3.2-RC1-56840';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.