summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-08-05 11:35:44 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-08-05 11:38:17 +0200
commit554e18ab025fcd86001faa57fab14fe3ca28a672 (patch)
treec50c0e8a1e5d41fdbbda5f3e530d128bca01cd22 /lib/api
parent460065b743a5f28d92bda71b0e778b01cd369d80 (diff)
downloadgitlab-ce-554e18ab025fcd86001faa57fab14fe3ca28a672.tar.gz
Create service for enabling deploy keys
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/deploy_keys.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/deploy_keys.rb b/lib/api/deploy_keys.rb
index 52f89373ad3..6dc9beb57ec 100644
--- a/lib/api/deploy_keys.rb
+++ b/lib/api/deploy_keys.rb
@@ -76,12 +76,12 @@ module API
requires :key_id, type: Integer, desc: 'The ID of the deploy key'
end
post ":id/#{path}/:key_id/enable" do
- key = DeployKey.find(params[:key_id])
+ key = EnableDeployKeyService.new(user_project, current_user, declared(params)).execute
- if user_project.deploy_keys << key
+ if key
present key, with: Entities::SSHKey
else
- render_validation_error!(key)
+ not_found!('Deploy Key')
end
end