Skip to content
Snippets Groups Projects
Commit 1c3a2bc3 authored by Michael Kozono's avatar Michael Kozono
Browse files

Setup LDAP settings properly

parent f3203cbb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -139,6 +139,8 @@ if Settings.ldap['enabled'] || Rails.env.test?
end
 
Settings.ldap['servers'].each do |key, server|
server = Settingslogic.new(server)
server['label'] ||= 'LDAP'
server['timeout'] ||= 10.seconds
server['block_auto_created_users'] = false if server['block_auto_created_users'].nil?
Loading
Loading
@@ -165,6 +167,8 @@ if Settings.ldap['enabled'] || Rails.env.test?
MSG
Rails.logger.warn(message)
end
Settings.ldap['servers'][key] = server
end
end
 
Loading
Loading
Loading
Loading
@@ -2,6 +2,22 @@ require 'spec_helper'
require_relative '../../config/initializers/1_settings'
 
describe Settings do
describe '#ldap' do
it 'can be accessed with dot syntax all the way down' do
expect(Gitlab.config.ldap.servers.main.label).to eq('ldap')
end
# Specifically trying to cause this error discovered in EE when removing the
# reassignment of each server element with Settingslogic.
#
# `undefined method `label' for #<Hash:0x007fbd18b59c08>`
#
it 'can be accessed in a very specific way that breaks without reassigning each element with Settingslogic' do
server_settings = Gitlab.config.ldap.servers['main']
expect(server_settings.label).to eq('ldap')
end
end
describe '#repositories' do
it 'assigns the default failure attributes' do
repository_settings = Gitlab.config.repositories.storages['broken']
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment