Commit b41c488b authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix-ghe-import' into 'master'

Fix importing projects from GitHub Enterprise Edition.

Addresses #333.

See merge request !473
parents 1f9487f7 caf8a949
v 7.14 v 7.14
- Disable adding, updating and removing members from a group that is synced with LDAP - Disable adding, updating and removing members from a group that is synced with LDAP
- Don't send "Added to group" notifications when group is LDAP synched - Don't send "Added to group" notifications when group is LDAP synched
- Fix importing projects from GitHub Enterprise Edition.
- Automatic approver suggestions (based on an authority of the code) - Automatic approver suggestions (based on an authority of the code)
v7.13.3 v7.13.3
......
...@@ -102,7 +102,7 @@ Settings.omniauth['providers'] ||= [] ...@@ -102,7 +102,7 @@ Settings.omniauth['providers'] ||= []
# Fill out omniauth-gitlab settings. It is needed for easy set up GHE or GH by just specifying url. # Fill out omniauth-gitlab settings. It is needed for easy set up GHE or GH by just specifying url.
github_default_url = "https://github.com" github_default_url = "https://github.com"
github_settings = Settings.omniauth['providers'].find{|provider| provider["name"] == "github"} github_settings = Settings.omniauth['providers'].find { |provider| provider["name"] == "github"}
if github_settings if github_settings
# For compatibility with old config files (before 7.8) # For compatibility with old config files (before 7.8)
...@@ -112,11 +112,7 @@ if github_settings ...@@ -112,11 +112,7 @@ if github_settings
end end
if github_settings["url"].include?(github_default_url) if github_settings["url"].include?(github_default_url)
github_settings["args"]["client_options"] = { github_settings["args"]["client_options"] = OmniAuth::Strategies::GitHub.default_options[:client_options]
"site" => 'https://api.github.com/',
"authorize_url" => 'https://github.com/login/oauth/authorize',
"token_url" => 'https://github.com/login/oauth/access_token'
}
else else
github_settings["args"]["client_options"] = { github_settings["args"]["client_options"] = {
"site" => File.join(github_settings["url"], "api/v3"), "site" => File.join(github_settings["url"], "api/v3"),
......
...@@ -42,11 +42,11 @@ module Gitlab ...@@ -42,11 +42,11 @@ module Gitlab
private private
def config def config
Gitlab.config.omniauth.providers.find{|provider| provider.name == "github"} Gitlab.config.omniauth.providers.find { |provider| provider.name == "github"}
end end
def github_options def github_options
OmniAuth::Strategies::GitHub.default_options[:client_options].symbolize_keys config["args"]["client_options"].deep_symbolize_keys
end end
end end
end end
......
...@@ -5,7 +5,8 @@ describe Gitlab::GithubImport::Client do ...@@ -5,7 +5,8 @@ describe Gitlab::GithubImport::Client do
let(:client) { Gitlab::GithubImport::Client.new(token) } let(:client) { Gitlab::GithubImport::Client.new(token) }
before do before do
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github") github_provider = OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github", args: { "client_options" => {} })
allow(Gitlab.config.omniauth).to receive(:providers).and_return([github_provider])
end end
it 'all OAuth2 client options are symbols' do it 'all OAuth2 client options are symbols' do
......
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