diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-03-16 18:20:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-03-16 18:20:08 +0000 |
commit | 899d410e0bfba47511dabe8413905bd489f7d960 (patch) | |
tree | eb893b76d1b623709aa2b849d2b188c52b7dc2fd /app/controllers/users_controller.rb | |
parent | 0786b9ef99b0797f06a72201b1581d7384efc624 (diff) | |
download | redmine-899d410e0bfba47511dabe8413905bd489f7d960.tar.gz redmine-899d410e0bfba47511dabe8413905bd489f7d960.zip |
Adds a Group filter on the admin users list (#7893).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5150 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c7f9dcf1b..2c4ca371e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2010 Jean-Philippe Lang +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -38,6 +38,9 @@ class UsersController < ApplicationController @limit = per_page_option end + scope = User + scope = scope.in_group(params[:group_id].to_i) if params[:group_id].present? + @status = params[:status] ? params[:status].to_i : 1 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) @@ -46,17 +49,20 @@ class UsersController < ApplicationController c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", name, name, name, name] end - @user_count = User.count(:conditions => c.conditions) + @user_count = scope.count(:conditions => c.conditions) @user_pages = Paginator.new self, @user_count, @limit, params['page'] @offset ||= @user_pages.current.offset - @users = User.find :all, + @users = scope.find :all, :order => sort_clause, :conditions => c.conditions, :limit => @limit, :offset => @offset respond_to do |format| - format.html { render :layout => !request.xhr? } + format.html { + @groups = Group.all.sort + render :layout => !request.xhr? + } format.api end end |