- Timestamp:
- 10/27/2021 06:42:13 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r51786 r51943 199 199 } 200 200 201 // Check if capabilities is specified in GET request and if user can list users. 202 if ( ! empty( $request['capabilities'] ) && ! current_user_can( 'list_users' ) ) { 203 return new WP_Error( 204 'rest_user_cannot_view', 205 __( 'Sorry, you are not allowed to filter users by capability.' ), 206 array( 'status' => rest_authorization_required_code() ) 207 ); 208 } 209 201 210 if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) { 202 211 return new WP_Error( … … 255 264 */ 256 265 $parameter_mappings = array( 257 'exclude' => 'exclude', 258 'include' => 'include', 259 'order' => 'order', 260 'per_page' => 'number', 261 'search' => 'search', 262 'roles' => 'role__in', 263 'slug' => 'nicename__in', 266 'exclude' => 'exclude', 267 'include' => 'include', 268 'order' => 'order', 269 'per_page' => 'number', 270 'search' => 'search', 271 'roles' => 'role__in', 272 'capabilities' => 'capability__in', 273 'slug' => 'nicename__in', 264 274 ); 265 275 … … 1555 1565 ); 1556 1566 1567 $query_params['capabilities'] = array( 1568 'description' => __( 'Limit result set to users matching at least one specific capability provided. Accepts csv list or single capability.' ), 1569 'type' => 'array', 1570 'items' => array( 1571 'type' => 'string', 1572 ), 1573 ); 1574 1557 1575 $query_params['who'] = array( 1558 1576 'description' => __( 'Limit result set to users who are considered authors.' ),
Note: See TracChangeset
for help on using the changeset viewer.