From 20baf029ba62bf21be10b96a1cbc13364912853f Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 27 Sep 2022 19:55:09 +0000 Subject: [PATCH] Fix undefined method when auth source name column is added as column (#37674). git-svn-id: https://svn.redmine.org/redmine/trunk@21861 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/auth_source.rb | 4 ++++ test/functional/users_controller_test.rb | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/app/models/auth_source.rb b/app/models/auth_source.rb index 242482a00..04bfc4463 100644 --- a/app/models/auth_source.rb +++ b/app/models/auth_source.rb @@ -72,6 +72,10 @@ class AuthSource < ActiveRecord::Base false end + def visible?(user=User.current) + user.admin? + end + def self.search(q) results = [] AuthSource.all.each do |source| diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index c17737fe1..52d604ee8 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -175,6 +175,20 @@ class UsersControllerTest < Redmine::ControllerTest end end + def test_index_with_auth_source_column + user = User.find(1) + user.update_column :auth_source_id, 1 + + get :index, params: { + set_filter: 1, + f: ['auth_source_id'], op: {auth_source_id: '='}, v: {auth_source_id: ['1']}, + c: %w(login firstname lastname mail auth_source.name) + } + assert_response :success + + assert_select 'tr#user-1', 1 + end + def test_index_csv with_settings :default_language => 'en' do user = User.logged.status(1).first -- 2.39.5