diff -r 0f84e0e6400e app/controllers/users_controller.rb
--- a/app/controllers/users_controller.rb Sun Sep 20 06:20:40 2015 +0000
+++ b/app/controllers/users_controller.rb Fri Oct 23 12:28:55 2015 +0200
@@ -46,6 +46,7 @@
scope = User.logged.status(@status).preload(:email_address)
scope = scope.like(params[:name]) if params[:name].present?
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
+ scope = scope.auth_source(params[:auth_source]) if (params[:auth_source].present? && !params[:auth_source].blank?)
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
diff -r 0f84e0e6400e app/helpers/users_helper.rb
--- a/app/helpers/users_helper.rb Sun Sep 20 06:20:40 2015 +0000
+++ b/app/helpers/users_helper.rb Fri Oct 23 12:28:44 2015 +0200
@@ -26,6 +26,15 @@
["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
end
+ def users_auth_sources_options_for_select(selected)
+ options = [[l(:label_all), ''],
+ [l(:label_internal), 'NULL']]
+ AuthSource.all.each do |as|
+ options << [as.name, as.id]
+ end
+ options_for_select(options, selected.to_s)
+ end
+
def user_mail_notification_options(user)
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
end
diff -r 0f84e0e6400e app/models/user.rb
--- a/app/models/user.rb Sun Sep 20 06:20:40 2015 +0000
+++ b/app/models/user.rb Fri Oct 23 12:29:06 2015 +0200
@@ -135,6 +135,13 @@
none
end
}
+ scope :auth_source, lambda {|auth_source_id|
+ if (auth_source_id == 'NULL')
+ where("#{User.table_name}.auth_source_id IS NULL", auth_source_id)
+ else
+ where("#{User.table_name}.auth_source_id = ?", auth_source_id)
+ end
+ }
def set_mail_notification
self.mail_notification = Setting.default_notification_option if self.mail_notification.blank?
diff -r 0f84e0e6400e app/views/users/index.html.erb
--- a/app/views/users/index.html.erb Sun Sep 20 06:20:40 2015 +0000
+++ b/app/views/users/index.html.erb Fri Oct 23 12:29:20 2015 +0200
@@ -16,6 +16,10 @@
<%= text_field_tag 'name', params[:name], :size => 30 %>
+
+<%= select_tag 'auth_source', users_auth_sources_options_for_select(params[:auth_source]), :onchange => "this.form.submit(); return false;" %>
+
+
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), users_path, :class => 'icon icon-reload' %>