diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-18 17:27:12 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-18 17:30:53 +0300 |
commit | 6226d19c711e34ed9fa6f8a61468cac7f10ba7cf (patch) | |
tree | 6bbc2464d8c20f15d980870202bdcbb160d5510c /lib/gitlab/auth | |
parent | 8b287679a1900185ecb6354ecdc8ac6d5a1e9ca1 (diff) |
Minimize CE/EE difference in Gitlab::Auth::LDAP::Config
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/gitlab/auth')
-rw-r--r-- | lib/gitlab/auth/ldap/config.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/gitlab/auth/ldap/config.rb b/lib/gitlab/auth/ldap/config.rb index 77185f52ced..d4415eaa6dc 100644 --- a/lib/gitlab/auth/ldap/config.rb +++ b/lib/gitlab/auth/ldap/config.rb @@ -11,6 +11,8 @@ module Gitlab attr_accessor :provider, :options + InvalidProvider = Class.new(StandardError) + def self.enabled? Gitlab.config.ldap.enabled end @@ -22,6 +24,10 @@ module Gitlab def self.available_servers return [] unless enabled? + _available_servers + end + + def self._available_servers Array.wrap(servers.first) end @@ -34,7 +40,7 @@ module Gitlab end def self.invalid_provider(provider) - raise "Unknown provider (#{provider}). Available providers: #{providers}" + raise InvalidProvider.new("Unknown provider (#{provider}). Available providers: #{providers}") end def initialize(provider) @@ -84,13 +90,17 @@ module Gitlab end def base - options['base'] + @base ||= Person.normalize_dn(options['base']) end def uid options['uid'] end + def label + options['label'] + end + def sync_ssh_keys? sync_ssh_keys.present? end @@ -132,6 +142,10 @@ module Gitlab options['timeout'].to_i end + def external_groups + options['external_groups'] || [] + end + def has_auth? options['password'] || options['bind_dn'] end |