diff options
author | Go MAEDA <maeda@farend.jp> | 2023-10-15 01:42:07 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-10-15 01:42:07 +0000 |
commit | ff93ee3cfaf4aae92e826c8e879e1bb648c0dddd (patch) | |
tree | b1b723612da5549ff0e2e2380f87ed340b839e08 /app/controllers | |
parent | 26c392d3c368af689df8c0c95863e3e0298d462a (diff) | |
download | redmine-ff93ee3cfaf4aae92e826c8e879e1bb648c0dddd.tar.gz redmine-ff93ee3cfaf4aae92e826c8e879e1bb648c0dddd.zip |
API compatibility to legacy status and name query params (#39181, #37674)
- 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
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/users_controller.rb | 13 |
1 files changed, 13 insertions, 0 deletions
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 |