Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-18 00:52:32 +0300
committerDouwe Maan <douwe@gitlab.com>2015-02-24 17:07:24 +0300
commit448817c4de965bf7286f33a3447937987a8864a1 (patch)
tree4429ddccab6ff9437950f449272dfdad7362d0b1 /app/controllers/import
parentad6d6232342558705c54ba70a94f9d7ddbd00f8c (diff)
Load public key in initializer.
Diffstat (limited to 'app/controllers/import')
-rw-r--r--app/controllers/import/bitbucket_controller.rb5
-rw-r--r--app/controllers/import/github_controller.rb5
-rw-r--r--app/controllers/import/gitlab_controller.rb5
3 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb
index 27e91f49f2b..89de5c5205f 100644
--- a/app/controllers/import/bitbucket_controller.rb
+++ b/app/controllers/import/bitbucket_controller.rb
@@ -1,4 +1,5 @@
class Import::BitbucketController < Import::BaseController
+ before_filter :verify_bitbucket_import_enabled
before_filter :bitbucket_auth, except: :callback
# rescue_from OAuth::Error, with: :bitbucket_unauthorized
@@ -55,6 +56,10 @@ class Import::BitbucketController < Import::BaseController
@client ||= Gitlab::BitbucketImport::Client.new(current_user.bitbucket_access_token, current_user.bitbucket_access_token_secret)
end
+ def verify_bitbucket_import_enabled
+ not_found! unless bitbucket_import_enabled?
+ end
+
def bitbucket_auth
if current_user.bitbucket_access_token.blank?
go_to_bitbucket_for_permissions
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index c869c7c86f3..dc7668ee6fd 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -1,4 +1,5 @@
class Import::GithubController < Import::BaseController
+ before_filter :verify_github_import_enabled
before_filter :github_auth, except: :callback
rescue_from Octokit::Unauthorized, with: :github_unauthorized
@@ -44,6 +45,10 @@ class Import::GithubController < Import::BaseController
@client ||= Gitlab::GithubImport::Client.new(current_user.github_access_token)
end
+ def verify_github_import_enabled
+ not_found! unless github_import_enabled?
+ end
+
def github_auth
if current_user.github_access_token.blank?
go_to_github_for_permissions
diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb
index a51ea36aff8..74f992b4699 100644
--- a/app/controllers/import/gitlab_controller.rb
+++ b/app/controllers/import/gitlab_controller.rb
@@ -1,4 +1,5 @@
class Import::GitlabController < Import::BaseController
+ before_filter :verify_gitlab_import_enabled
before_filter :gitlab_auth, except: :callback
rescue_from OAuth2::Error, with: :gitlab_unauthorized
@@ -41,6 +42,10 @@ class Import::GitlabController < Import::BaseController
@client ||= Gitlab::GitlabImport::Client.new(current_user.gitlab_access_token)
end
+ def verify_gitlab_import_enabled
+ not_found! unless gitlab_import_enabled?
+ end
+
def gitlab_auth
if current_user.gitlab_access_token.blank?
go_to_gitlab_for_permissions