From ff93ee3cfaf4aae92e826c8e879e1bb648c0dddd Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 15 Oct 2023 01:42:07 +0000 Subject: API compatibility to legacy status and name query params (#39181, #37674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - adds 'name' filter that mimics the old behavior of matching on email, login, first- or lastname - maps the 'status' url parameter to the status_id filter, and the 'name' url parameter to the new name filter Patch by Jens Krämer. git-svn-id: https://svn.redmine.org/redmine/trunk@22343 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/users_controller.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 77ec1a601..f64c469da 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -45,6 +45,19 @@ class UsersController < ApplicationController use_session = !request.format.csv? retrieve_query(UserQuery, use_session) + # API backwards compatibility: handle legacy status and name filter parameters + unless request.format.html? + if status_id = params[:status].presence + @query.add_filter 'status', '=', [status_id] + end + if name = params[:name].presence + @query.add_filter 'name', '~', [name] + end + if group_id = params[:group_id].presence + @query.add_filter 'is_member_of_group', '=', [group_id] + end + end + if @query.valid? scope = @query.results_scope -- cgit v1.2.3