diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-11-06 16:20:44 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-11-06 16:20:44 +0300 |
commit | 9b58b8e363fd388635385085c58be3d4637eaa45 (patch) | |
tree | e348f8d2cf9030d59448cea3dbc459a29bbecf95 /app/controllers/projects | |
parent | d4ceec9d47a7da5fa17cb6e161ac491e13fcb8bd (diff) |
Do not allow jobs to be erased
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/jobs_controller.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index 1b985ea9763..fd6708666c3 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -5,6 +5,7 @@ class Projects::JobsController < Projects::ApplicationController only: [:index, :show, :status, :raw, :trace] before_action :authorize_update_build!, except: [:index, :show, :status, :raw, :trace, :cancel_all] + before_action :authorize_erase_build!, only: [:erase] layout 'project' @@ -131,6 +132,10 @@ class Projects::JobsController < Projects::ApplicationController return access_denied! unless can?(current_user, :update_build, build) end + def authorize_erase_build! + return access_denied! unless can?(current_user, :erase_build, build) + end + def build @build ||= project.builds.find(params[:id]) .present(current_user: current_user) |