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
path: root/lib/api
diff options
context:
space:
mode:
authorAram Visser <hello@aramvisser.com>2018-06-24 09:10:15 +0300
committerAram Visser <hello@aramvisser.com>2018-06-27 14:21:18 +0300
commitc3de6a86734f8756de214cc87ac230820fa33acc (patch)
treee3db898a5a56d6afaf552d82c12e2b3e1d42fafa /lib/api
parent2452f1a73e8dcf646311c6069a077ab66be5ce51 (diff)
Add transfer project endpoint to the Projects API
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/projects.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 3ef3680c5d9..b83da00502d 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -459,6 +459,23 @@ module API
conflict!(error.message)
end
end
+
+ desc 'Transfer a project to a new namespace'
+ params do
+ requires :namespace, type: String, desc: 'The ID or path of the new namespace'
+ end
+ put ":id/transfer" do
+ authorize! :change_namespace, user_project
+
+ namespace = find_namespace!(params[:namespace])
+ result = ::Projects::TransferService.new(user_project, current_user).execute(namespace)
+
+ if result
+ present user_project, with: Entities::Project
+ else
+ render_api_error!("Failed to transfer project #{user_project.errors.messages}", 400)
+ end
+ end
end
end
end