summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-07-15 19:15:10 +0200
committerMatija Čupić <matteeyah@gmail.com>2019-07-23 11:48:23 +0200
commit1f403720293393f0f0bf6f99476abe4ba79580a4 (patch)
tree6d91fecc92f3807c486d9a380abdc4aae2a17bec /app/controllers
parent96277bb9d61b5aaf5c2edc388c5eabfc743478f0 (diff)
downloadgitlab-ce-1f403720293393f0f0bf6f99476abe4ba79580a4.tar.gz
Do not authorize with OAuth for CICD only projectsmc/feature/use-only-pat-cicd-projects
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/import/github_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index aa4aa0fbdac..ebb50fc8b10 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -10,7 +10,7 @@ class Import::GithubController < Import::BaseController
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
def new
- if github_import_configured? && logged_in_with_provider?
+ if !ci_cd_only? && github_import_configured? && logged_in_with_provider?
go_to_provider_for_permissions
elsif session[access_token_key]
redirect_to status_import_url
@@ -169,11 +169,15 @@ class Import::GithubController < Import::BaseController
# rubocop: enable CodeReuse/ActiveRecord
def provider_auth
- if session[access_token_key].blank?
+ if !ci_cd_only? && session[access_token_key].blank?
go_to_provider_for_permissions
end
end
+ def ci_cd_only?
+ %w[1 true].include?(params[:ci_cd_only])
+ end
+
def client_options
{}
end