Commit c4d487a7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ldap-fixes' into 'master'

Ldap fixes

Solves #1688 and #1686

See merge request !1193
parents c5360a58 61d9d4e2
...@@ -61,7 +61,6 @@ Settings.ldap['enabled'] = false if Settings.ldap['enabled'].nil? ...@@ -61,7 +61,6 @@ Settings.ldap['enabled'] = false if Settings.ldap['enabled'].nil?
if Settings.ldap['enabled'] || Rails.env.test? if Settings.ldap['enabled'] || Rails.env.test?
if Settings.ldap['host'].present? if Settings.ldap['host'].present?
server = Settings.ldap.except('sync_time') server = Settings.ldap.except('sync_time')
server['label'] = 'LDAP'
server['provider_name'] = 'ldap' server['provider_name'] = 'ldap'
Settings.ldap['servers'] = { Settings.ldap['servers'] = {
'ldap' => server 'ldap' => server
...@@ -69,6 +68,7 @@ if Settings.ldap['enabled'] || Rails.env.test? ...@@ -69,6 +68,7 @@ if Settings.ldap['enabled'] || Rails.env.test?
end end
Settings.ldap['servers'].each do |key, server| Settings.ldap['servers'].each do |key, server|
server['label'] ||= 'LDAP'
server['allow_username_or_email_login'] = false if server['allow_username_or_email_login'].nil? server['allow_username_or_email_login'] = false if server['allow_username_or_email_login'].nil?
server['active_directory'] = true if server['active_directory'].nil? server['active_directory'] = true if server['active_directory'].nil?
server['provider_name'] ||= "ldap#{key}".downcase server['provider_name'] ||= "ldap#{key}".downcase
......
if Gitlab::LDAP::Config.enabled? if Gitlab::LDAP::Config.enabled?
module OmniAuth::Strategies module OmniAuth::Strategies
server = Gitlab.config.ldap.servers.values.first server = Gitlab.config.ldap.servers.values.first
const_set(server['provider_class'], Class.new(LDAP)) klass = server['provider_class']
const_set(klass, Class.new(LDAP)) unless klass == 'LDAP'
end end
OmniauthCallbacksController.class_eval do OmniauthCallbacksController.class_eval do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment