Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
810ef92863f3
Commit
73a3df4d
authored
Sep 23, 2015
by
Douwe Maan
Browse files
Fix LDAP attribute mapping
parent
3749916f18bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/ldap/auth_hash.rb
View file @
810ef928
...
...
@@ -6,7 +6,7 @@ class AuthHash < Gitlab::OAuth::AuthHash
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 @@ def get_info(key)
value
=
nil
attributes
.
each
do
|
attribute
|
value
=
get_raw
(
attribute
)
value
=
value
.
first
if
value
break
if
value
.
present?
end
...
...
spec/lib/gitlab/ldap/auth_hash_spec.rb
View file @
810ef928
...
...
@@ -24,10 +24,10 @@
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 @@
context
"with overridden attributes"
do
let
(
:attributes
)
do
{
username
:
[
'mail'
,
'email'
],
name
:
'fullName'
'
username
'
=>
[
'mail'
,
'email'
],
'
name
'
=>
'fullName'
}
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment