Add bulk lock feature to user list context menu (#40913).

Patch by Mizuki ISHIKAWA (@ishikawa999).


git-svn-id: https://svn.redmine.org/redmine/trunk@22898 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2024-06-25 19:03:36 +00:00
parent 0afa535765
commit 193ca9faee
6 changed files with 56 additions and 23 deletions

View File

@@ -231,17 +231,22 @@ class UsersController < ApplicationController
@users = User.logged.where(id: params[:ids]).where.not(id: User.current)
(render_404; return) unless @users.any?
if params[:lock]
@users.update_all status: User::STATUS_LOCKED
flash[:notice] = l(:notice_successful_update)
redirect_to users_path
elsif params[:confirm] == I18n.t(:general_text_Yes)
if params[:confirm] == I18n.t(:general_text_Yes)
@users.destroy_all
flash[:notice] = l(:notice_successful_delete)
redirect_to users_path
end
end
def bulk_lock
@users = User.logged.where(id: params[:ids]).where.not(id: User.current)
(render_404; return) unless @users.any?
@users.update_all status: User::STATUS_LOCKED
flash[:notice] = l(:notice_successful_update)
redirect_to users_path
end
private
def find_user(logged = true)