Add attributes to LDAP::Config.
This commit is contained in:
parent
c915e2c823
commit
0e9ba0a4fa
|
@ -97,6 +97,7 @@ if Settings.ldap['enabled'] || Rails.env.test?
|
|||
server['block_auto_created_users'] = false if server['block_auto_created_users'].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['attributes'] = {} if server['attributes'].nil?
|
||||
server['provider_name'] ||= "ldap#{key}".downcase
|
||||
server['provider_class'] = OmniAuth::Utils.camelize(server['provider_name'])
|
||||
end
|
||||
|
|
|
@ -84,6 +84,10 @@ module Gitlab
|
|||
options['block_auto_created_users']
|
||||
end
|
||||
|
||||
def attributes
|
||||
options['attributes']
|
||||
end
|
||||
|
||||
protected
|
||||
def base_config
|
||||
Gitlab.config.ldap
|
||||
|
|
|
@ -68,12 +68,13 @@ module Gitlab
|
|||
Gitlab::LDAP::Access.allowed?(gl_user)
|
||||
end
|
||||
|
||||
def ldap_config
|
||||
Gitlab::LDAP::Config.new(auth_hash.provider)
|
||||
def ldap_config(provider = auth_hash.provider)
|
||||
Gitlab::LDAP::Config.new(provider)
|
||||
end
|
||||
|
||||
def auth_hash=(auth_hash)
|
||||
@auth_hash = Gitlab::LDAP::AuthHash.new(auth_hash, ldap_config)
|
||||
config = ldap_config(auth_hash.provider)
|
||||
@auth_hash = Gitlab::LDAP::AuthHash.new(auth_hash, config)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ describe Gitlab::LDAP::User do
|
|||
}
|
||||
end
|
||||
let(:auth_hash) do
|
||||
double(uid: 'my-uid', provider: 'ldapmain', info: double(info))
|
||||
OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info)
|
||||
end
|
||||
|
||||
describe :changed? do
|
||||
|
|
Loading…
Reference in New Issue