diff options
author | Rémy Coutable <remy@rymai.me> | 2018-12-11 11:12:23 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-12-11 11:12:23 +0000 |
commit | 352af3e57220e3f0178da8de2c3f03c42c419a9b (patch) | |
tree | 68e9b4d6a86f9898d9cdebc1c9c4d7eafae1e22d | |
parent | 7c4940b70236347d06d7c4b559dcc50a8e68d8c0 (diff) | |
parent | b4e2679437558e48c9055ac499ce775cce9b191d (diff) | |
download | gitlab-ce-352af3e57220e3f0178da8de2c3f03c42c419a9b.tar.gz |
Merge branch 'sh-fix-github-import-without-oauth2-config' into 'master'
Allow GitHub imports via token even if OAuth2 provider not configured
Closes #38524
See merge request gitlab-org/gitlab-ce!23703
-rw-r--r-- | app/controllers/import/github_controller.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/sh-fix-github-import-without-oauth2-config.yml | 5 | ||||
-rw-r--r-- | spec/controllers/import/github_controller_spec.rb | 9 |
3 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index 58565aaf8c9..d4c26fa0709 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -7,7 +7,7 @@ class Import::GithubController < Import::BaseController rescue_from Octokit::Unauthorized, with: :provider_unauthorized def new - if logged_in_with_provider? + if github_import_configured? && logged_in_with_provider? go_to_provider_for_permissions elsif session[access_token_key] redirect_to status_import_url diff --git a/changelogs/unreleased/sh-fix-github-import-without-oauth2-config.yml b/changelogs/unreleased/sh-fix-github-import-without-oauth2-config.yml new file mode 100644 index 00000000000..ad548a6ff35 --- /dev/null +++ b/changelogs/unreleased/sh-fix-github-import-without-oauth2-config.yml @@ -0,0 +1,5 @@ +--- +title: Allow GitHub imports via token even if OAuth2 provider not configured +merge_request: 23703 +author: +type: fixed diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb index 9bbd97ec305..780e49f7b93 100644 --- a/spec/controllers/import/github_controller_spec.rb +++ b/spec/controllers/import/github_controller_spec.rb @@ -16,6 +16,15 @@ describe Import::GithubController do get :new end + + it "prompts for an access token if GitHub not configured" do + allow(controller).to receive(:github_import_configured?).and_return(false) + expect(controller).not_to receive(:go_to_provider_for_permissions) + + get :new + + expect(response).to have_http_status(200) + end end describe "GET callback" do |