summaryrefslogtreecommitdiff
path: root/lib/api/deploy_tokens.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 12:08:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 12:08:18 +0000
commit684d65316ac77c62f47d68b9926eea8af30db227 (patch)
treed1f4c4eec399d7772ab4ad6294f98e7505c1cee5 /lib/api/deploy_tokens.rb
parentade18c9d68d5a2e6c6e28ef7e9d3add3b3491ace (diff)
downloadgitlab-ce-684d65316ac77c62f47d68b9926eea8af30db227.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/deploy_tokens.rb')
-rw-r--r--lib/api/deploy_tokens.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/api/deploy_tokens.rb b/lib/api/deploy_tokens.rb
index fb4c4265aef..d36b75f5bfd 100644
--- a/lib/api/deploy_tokens.rb
+++ b/lib/api/deploy_tokens.rb
@@ -85,12 +85,10 @@ module API
delete ':id/deploy_tokens/:token_id' do
authorize!(:destroy_deploy_token, user_project)
- deploy_token = user_project.project_deploy_tokens
- .find_by_deploy_token_id(params[:token_id])
-
- not_found!('Deploy Token') unless deploy_token
+ ::Projects::DeployTokens::DestroyService.new(
+ user_project, current_user, token_id: params[:token_id]
+ ).execute
- deploy_token.destroy
no_content!
end
end
@@ -144,13 +142,17 @@ module API
desc 'Delete a group deploy token' do
detail 'This feature was introduced in GitLab 12.9'
end
+ params do
+ requires :token_id, type: Integer, desc: 'The deploy token ID'
+ end
delete ':id/deploy_tokens/:token_id' do
authorize!(:destroy_deploy_token, user_group)
- deploy_token = user_group.group_deploy_tokens
- .find_by_deploy_token_id!(params[:token_id])
+ ::Groups::DeployTokens::DestroyService.new(
+ user_group, current_user, token_id: params[:token_id]
+ ).execute
- destroy_conditionally!(deploy_token)
+ no_content!
end
end
end