Commit 4e925d80 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'issue-ldap-initialization' into 'master'

Issue ldap initialization

If LDAP is disabled error will appear:

```
ERROR -- : Missing setting 'servers' in 'ldap' section in /Volumes/Work/gitlab/development/community/gitlab/config/gitlab.yml (Settingslogic::MissingSetting)
```

@marin Can you test if this will solve the startup problem?

See merge request !1179
parents e3bd17a7 dcf6c260
module OmniAuth::Strategies if Gitlab::LDAP::Config.enabled?
module OmniAuth::Strategies
server = Gitlab.config.ldap.servers.values.first server = Gitlab.config.ldap.servers.values.first
const_set(server['provider_class'], Class.new(LDAP)) const_set(server['provider_class'], Class.new(LDAP))
end end
OmniauthCallbacksController.class_eval do OmniauthCallbacksController.class_eval do
server = Gitlab.config.ldap.servers.values.first server = Gitlab.config.ldap.servers.values.first
alias_method server['provider_name'], :ldap alias_method server['provider_name'], :ldap
end
end end
\ No newline at end of file
...@@ -204,7 +204,7 @@ Devise.setup do |config| ...@@ -204,7 +204,7 @@ Devise.setup do |config|
# manager.default_strategies(scope: :user).unshift :some_external_strategy # manager.default_strategies(scope: :user).unshift :some_external_strategy
# end # end
if Gitlab.config.ldap.enabled if Gitlab::LDAP::Config.enabled?
Gitlab.config.ldap.servers.values.each do |server| Gitlab.config.ldap.servers.values.each do |server|
if server['allow_username_or_email_login'] if server['allow_username_or_email_login']
email_stripping_proc = ->(name) {name.gsub(/@.*$/,'')} email_stripping_proc = ->(name) {name.gsub(/@.*$/,'')}
......
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