Commit db29ef3a authored by Douwe Maan's avatar Douwe Maan Committed by Robert Speicher

Fix LDAP attribute mapping

parent 8ba96d3c
......@@ -6,7 +6,7 @@ module Gitlab
private
def get_info(key)
attributes = ldap_config.attributes[key]
attributes = ldap_config.attributes[key.to_s]
return super unless attributes
attributes = Array(attributes)
......@@ -14,6 +14,7 @@ module Gitlab
value = nil
attributes.each do |attribute|
value = get_raw(attribute)
value = value.first if value
break if value.present?
end
......
......@@ -24,10 +24,10 @@ describe Gitlab::LDAP::AuthHash do
let(:raw_info) do
{
uid: '123456',
email: 'johnsmith@example.com',
cn: 'Smith, J.',
fullName: 'John Smith'
uid: ['123456'],
email: ['johnsmith@example.com'],
cn: ['Smith, J.'],
fullName: ['John Smith']
}
end
......@@ -45,8 +45,8 @@ describe Gitlab::LDAP::AuthHash do
context "with overridden attributes" do
let(:attributes) do
{
username: ['mail', 'email'],
name: 'fullName'
'username' => ['mail', 'email'],
'name' => 'fullName'
}
end
......
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