summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-12-05 23:23:59 -0800
committerStan Hu <stanhu@gmail.com>2017-12-12 15:07:24 -0800
commitbc2d32aca0be46250bd02c9312d1064df024b621 (patch)
tree606015ccb2deb339f10db6830c052f210718a384 /app/controllers
parentf6966cfa63fab7e3c8847d69101c6c6a444fb85f (diff)
downloadgitlab-ce-bc2d32aca0be46250bd02c9312d1064df024b621.tar.gz
Create a play_pipeline_schedule policy and use it
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/pipeline_schedules_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/projects/pipeline_schedules_controller.rb b/app/controllers/projects/pipeline_schedules_controller.rb
index 38edb38f9fc..a4e865cb9da 100644
--- a/app/controllers/projects/pipeline_schedules_controller.rb
+++ b/app/controllers/projects/pipeline_schedules_controller.rb
@@ -1,7 +1,7 @@
class Projects::PipelineSchedulesController < Projects::ApplicationController
before_action :schedule, except: [:index, :new, :create]
- before_action :authorize_create_pipeline!, only: [:play]
+ before_action :authorize_play_pipeline_schedule!, only: [:play]
before_action :authorize_read_pipeline_schedule!
before_action :authorize_create_pipeline_schedule!, only: [:new, :create]
before_action :authorize_update_pipeline_schedule!, except: [:index, :new, :create, :play]
@@ -84,6 +84,10 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
variables_attributes: [:id, :key, :value, :_destroy] )
end
+ def authorize_play_pipeline_schedule!
+ return access_denied! unless can?(current_user, :play_pipeline_schedule, schedule)
+ end
+
def authorize_update_pipeline_schedule!
return access_denied! unless can?(current_user, :update_pipeline_schedule, schedule)
end