REST API: Limit `search_columns` for users without `list_users`.

Props Vortfu, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis.




Built from https://develop.svn.wordpress.org/trunk@56833


git-svn-id: http://core.svn.wordpress.org/trunk@56345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-10-12 12:30:20 +00:00
parent 598f1aeeb9
commit 4cfb52760f
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 ( ! current_user_can( 'list_users' ) ) {
$prepared_args['search_columns'] = array( 'ID', 'user_login', 'user_nicename', 'display_name' );
}
$prepared_args['search'] = '*' . $prepared_args['search'] . '*';
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-beta3-56832';
$wp_version = '6.4-beta3-56833';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.