diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-09-16 09:14:04 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-09-16 09:14:04 +0200 |
commit | 84d57bc70391f0419bc60c8fcffb3694078d8fb9 (patch) | |
tree | fe5d3321c429b71d059b89d51e86bd73d809fa88 /lib | |
parent | bed263f0fe3aa8485b3f07318c00a6164ca6f927 (diff) | |
download | gitlab-ce-84d57bc70391f0419bc60c8fcffb3694078d8fb9.tar.gz |
Make code clearerldap-attributes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ldap/auth_hash.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/gitlab/ldap/auth_hash.rb b/lib/gitlab/ldap/auth_hash.rb index dc8a8fd41dd..55deeeacd90 100644 --- a/lib/gitlab/ldap/auth_hash.rb +++ b/lib/gitlab/ldap/auth_hash.rb @@ -6,18 +6,16 @@ module Gitlab private def get_info(key) - raw_key = ldap_config.attributes[key] - return super unless raw_key + attributes = ldap_config.attributes[key] + return super unless attributes - value = - case raw_key - when String - get_raw(raw_key) - when Array - raw_key.inject(nil) { |value, key| value || get_raw(key).presence } - else - nil - end + attributes = Array(attributes) + + value = nil + attributes.each do |attribute| + value = get_raw(attribute) + break if value.present? + end return super unless value |