- Timestamp:
- 11/15/2016 10:22:33 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r39250 r39257 145 145 // Check if roles is specified in GET request and if user can list users. 146 146 if ( ! empty( $request['roles'] ) && ! current_user_can( 'list_users' ) ) { 147 return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you cannotfilter by role.' ), array( 'status' => rest_authorization_required_code() ) );147 return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to filter by role.' ), array( 'status' => rest_authorization_required_code() ) ); 148 148 } 149 149 150 150 if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) { 151 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannotview this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );151 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) ); 152 152 } 153 153 154 154 if ( in_array( $request['orderby'], array( 'email', 'registered_date' ), true ) && ! current_user_can( 'list_users' ) ) { 155 return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you cannotorder by this parameter.' ), array( 'status' => rest_authorization_required_code() ) );155 return new WP_Error( 'rest_forbidden_orderby', __( 'Sorry, you are not allowed to order by this parameter.' ), array( 'status' => rest_authorization_required_code() ) ); 156 156 } 157 157 … … 321 321 322 322 if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) { 323 return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you cannotview this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );323 return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) ); 324 324 } elseif ( ! count_user_posts( $id, $types ) && ! current_user_can( 'edit_user', $id ) && ! current_user_can( 'list_users' ) ) { 325 return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you cannotview this resource.' ), array( 'status' => rest_authorization_required_code() ) );325 return new WP_Error( 'rest_user_cannot_view', __( 'Sorry, you are not allowed to view this resource.' ), array( 'status' => rest_authorization_required_code() ) ); 326 326 } 327 327 … … 996 996 && ! $potential_role->has_cap( 'edit_users' ) 997 997 ) { 998 return new WP_Error( 'rest_user_invalid_role', __( ' You cannotgive resource that role.' ), array( 'status' => rest_authorization_required_code() ) );998 return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resource that role.' ), array( 'status' => rest_authorization_required_code() ) ); 999 999 } 1000 1000 … … 1006 1006 1007 1007 if ( empty( $editable_roles[ $role ] ) ) { 1008 return new WP_Error( 'rest_user_invalid_role', __( ' You cannotgive resource that role.' ), array( 'status' => 403 ) );1008 return new WP_Error( 'rest_user_invalid_role', __( 'Sorry, you are not allowed to give resource that role.' ), array( 'status' => 403 ) ); 1009 1009 } 1010 1010 }
Note: See TracChangeset
for help on using the changeset viewer.