diff options
Diffstat (limited to 'app/controllers/projects/pipelines_controller.rb')
-rw-r--r-- | app/controllers/projects/pipelines_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 036ea45cc78..cd2db2dad2c 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -18,7 +18,8 @@ class Projects::PipelinesController < Projects::ApplicationController before_action :authorize_read_build!, only: [:index, :show] before_action :authorize_read_ci_cd_analytics!, only: [:charts] before_action :authorize_create_pipeline!, only: [:new, :create] - before_action :authorize_update_pipeline!, only: [:retry, :cancel] + before_action :authorize_update_pipeline!, only: [:retry] + before_action :authorize_cancel_pipeline!, only: [:cancel] before_action :ensure_pipeline, only: [:show, :downloadable_artifacts] before_action :reject_if_build_artifacts_size_refreshing!, only: [:destroy] @@ -303,6 +304,10 @@ class Projects::PipelinesController < Projects::ApplicationController return access_denied! unless can?(current_user, :update_pipeline, @pipeline) end + def authorize_cancel_pipeline! + return access_denied! unless can?(current_user, :cancel_pipeline, @pipeline) + end + def limited_pipelines_count(project, scope = nil) finder = Ci::PipelinesFinder.new(project, current_user, index_params.merge(scope: scope)) |