diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-02 00:13:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-02 00:13:36 +0300 |
commit | e415571a6e766e961cd49a0ac92576c460a49e4d (patch) | |
tree | ac24a689ea599cb1ef4ff2dcea38984e8b5502c8 /lib/api | |
parent | 68ce709bef9bc89bbb9869e24508777bbe0a1a1d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/ci/jobs.rb | 4 | ||||
-rw-r--r-- | lib/api/helpers.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/ci/jobs.rb b/lib/api/ci/jobs.rb index 47e4135db27..250fe249489 100644 --- a/lib/api/ci/jobs.rb +++ b/lib/api/ci/jobs.rb @@ -122,10 +122,10 @@ module API requires :job_id, type: Integer, desc: 'The ID of a job', documentation: { example: 88 } end post ':id/jobs/:job_id/cancel', urgency: :low, feature_category: :continuous_integration do - authorize_update_builds! + authorize_cancel_builds! build = find_build!(params[:job_id]) - authorize!(:update_build, build) + authorize!(:cancel_build, build) build.cancel diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index a7e0a551283..f17474394e2 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -397,6 +397,10 @@ module API authorize! :update_build, user_project end + def authorize_cancel_builds! + authorize! :cancel_build, user_project + end + def require_repository_enabled!(subject = :global) not_found!("Repository") unless user_project.feature_available?(:repository, current_user) end |