summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-10 00:08:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-10 00:08:52 +0000
commit38c1da5195bdcaab0b20bf6303a675b9283ac476 (patch)
tree0619c87e942aa03fb6e1c050daabe961f8d01e0a /lib/api
parentab5672c13d7fe5c79fdeac10e7505187cf4ba606 (diff)
downloadgitlab-ce-38c1da5195bdcaab0b20bf6303a675b9283ac476.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/project_import.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb
index a00ef7144d4..6639b3ec346 100644
--- a/lib/api/project_import.rb
+++ b/lib/api/project_import.rb
@@ -33,16 +33,14 @@ module API
end
end
- before do
- forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project')
- end
-
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Workhorse authorize the project import upload' do
detail 'This feature was introduced in GitLab 12.9'
tags ['project_import']
end
post 'import/authorize' do
+ forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project')
+
require_gitlab_workhorse!
status 200
@@ -90,6 +88,8 @@ module API
consumes ['multipart/form-data']
end
post 'import' do
+ forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project')
+
require_gitlab_workhorse!
check_rate_limit! :project_import, scope: [current_user, :project_import]
@@ -164,6 +164,8 @@ module API
]
end
post 'remote-import' do
+ forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project')
+
check_rate_limit! :project_import, scope: [current_user, :project_import]
response = ::Import::GitlabProjects::CreateProjectService.new(
@@ -217,6 +219,8 @@ module API
]
end
post 'remote-import-s3' do
+ forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project')
+
check_rate_limit! :project_import, scope: [current_user, :project_import]
response = ::Import::GitlabProjects::CreateProjectService.new(