Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit 42a5c0e6 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Bitbucket import: provider defaulting to `bitbucket`

With this, if the `bitbucket_import` provider doesn't exist, the
import will use the `bitbucket` one.

In other words, this restores backwards compatibility after
introduction of `bitbucket_import`

--HG--
branch : heptapod
parent f21e3f072abd
......@@ -73,7 +73,8 @@ def client
end
def provider
Gitlab::Auth::OAuth::Provider.config_for('bitbucket_import')
Gitlab::Auth::OAuth::Provider.config_for('bitbucket_import',
fallback='bitbucket')
end
def options
......
......@@ -59,7 +59,8 @@ def root_url
end
def provider
Gitlab::Auth::OAuth::Provider.config_for('bitbucket_import')
Gitlab::Auth::OAuth::Provider.config_for('bitbucket_import',
fallback='bitbucket')
end
def options
......
......@@ -56,7 +56,7 @@ def self.sync_profile_from_provider?(provider)
end
end
def self.config_for(name)
def self.config_for(name, fallback=nil)
name = name.to_s
if ldap_provider?(name)
if Gitlab::Auth::LDAP::Config.valid_provider?(name)
......@@ -65,7 +65,13 @@ def self.config_for(name)
nil
end
else
Gitlab.config.omniauth.providers.find { |provider| provider.name == name }
providers = Gitlab.config.omniauth.providers
prov = providers.find { |provider| provider.name == name }
if prov.nil? && !fallback.nil?
providers.find{ |provider| provider.name == fallback }
else
prov
end
end
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