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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-02 00:13:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-02 00:13:36 +0300
commite415571a6e766e961cd49a0ac92576c460a49e4d (patch)
treeac24a689ea599cb1ef4ff2dcea38984e8b5502c8 /lib
parent68ce709bef9bc89bbb9869e24508777bbe0a1a1d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/ci/jobs.rb4
-rw-r--r--lib/api/helpers.rb4
-rw-r--r--lib/gitlab/ci/status/build/cancelable.rb2
3 files changed, 7 insertions, 3 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
diff --git a/lib/gitlab/ci/status/build/cancelable.rb b/lib/gitlab/ci/status/build/cancelable.rb
index 43fb5cdbbe6..b8c8cfa802c 100644
--- a/lib/gitlab/ci/status/build/cancelable.rb
+++ b/lib/gitlab/ci/status/build/cancelable.rb
@@ -6,7 +6,7 @@ module Gitlab
module Build
class Cancelable < Status::Extended
def has_action?
- can?(user, :update_build, subject)
+ can?(user, :cancel_build, subject)
end
def action_icon