diff options
author | James Lopez <james@jameslopez.es> | 2018-02-13 15:18:52 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-02-13 15:25:49 +0100 |
commit | e8813520029f0f07b0cf2d8463337ae09f15b7fe (patch) | |
tree | 0e85d323efdf3bc51adf727f62129e4e44b2c203 /lib/api/project_import.rb | |
parent | 39122ea40dda9a1c5b353fc671219b51c625f6cb (diff) | |
download | gitlab-ce-e8813520029f0f07b0cf2d8463337ae09f15b7fe.tar.gz |
refactor api class
Diffstat (limited to 'lib/api/project_import.rb')
-rw-r--r-- | lib/api/project_import.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/api/project_import.rb b/lib/api/project_import.rb index e93c14ddcf5..b0511342b63 100644 --- a/lib/api/project_import.rb +++ b/lib/api/project_import.rb @@ -13,7 +13,7 @@ module API end before do - not_found! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project') + forbidden! unless Gitlab::CurrentSettings.import_sources.include?('gitlab_project') end resource :projects, requirements: { id: %r{[^/]+} } do @@ -22,12 +22,14 @@ module API requires :file, type: File, desc: 'The project export file to be imported' optional :namespace, type: String, desc: 'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.' end - desc 'Get export status' do + desc 'Create a new project import' do success Entities::ProjectImportStatus end post 'import' do render_api_error!('The file is invalid', 400) unless file_is_valid? + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42437') + namespace = import_params[:namespace] namespace = if namespace.blank? current_user.namespace @@ -49,7 +51,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - desc 'Get export status' do + desc 'Get a project export status' do success Entities::ProjectImportStatus end get ':id/import' do |