diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2024-07-13 10:21:49 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2024-07-13 10:21:49 +0000 |
commit | 6322650728c8c642ee370f45c4f118896fd6f0c8 (patch) | |
tree | ec442e176773b56d958377be26f818b7e92ee6f6 /app/controllers | |
parent | 20dcd39f4250b4df1216c34db0d76656fe0ecd0c (diff) | |
download | redmine-6322650728c8c642ee370f45c4f118896fd6f0c8.tar.gz redmine-6322650728c8c642ee370f45c4f118896fd6f0c8.zip |
Add bulk unlock to user list context menu (#40913).
git-svn-id: https://svn.redmine.org/redmine/trunk@22925 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/users_controller.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 26e9151d9..d2ebd668d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -239,12 +239,11 @@ class UsersController < ApplicationController end def bulk_lock - @users = User.logged.where(id: params[:ids]).where.not(id: User.current) - (render_404; return) unless @users.any? + bulk_update_status(params[:ids], User::STATUS_LOCKED) + end - @users.update_all status: User::STATUS_LOCKED - flash[:notice] = l(:notice_successful_update) - redirect_to users_path + def bulk_unlock + bulk_update_status(params[:ids], User::STATUS_ACTIVE) end private @@ -261,4 +260,13 @@ class UsersController < ApplicationController rescue ActiveRecord::RecordNotFound render_404 end + + def bulk_update_status(user_ids, status) + users = User.logged.where(id: user_ids).where.not(id: User.current) + (render_404; return) unless users.any? + + users.update_all status: status + flash[:notice] = l(:notice_successful_update) + redirect_to users_path + end end |