Commit e1ba0058 authored by Shinya Maeda's avatar Shinya Maeda

zh nich catches 2

parent 8889bb63
class Projects::PipelineSchedulesController < Projects::ApplicationController class Projects::PipelineSchedulesController < Projects::ApplicationController
before_action :schedule, only: [:edit, :update, :destroy, :take_ownership] before_action :schedule, except: [:index, :new, :create]
before_action :authorize_read_pipeline_schedule! before_action :authorize_read_pipeline_schedule!
before_action :authorize_create_pipeline_schedule!, only: [:new, :create] before_action :authorize_create_pipeline_schedule!, only: [:new, :create]
before_action :authorize_update_pipeline_schedule!, only: [:edit, :take_ownership, :update] before_action :authorize_update_pipeline_schedule!, except: [:index, :new, :create]
before_action :authorize_admin_pipeline_schedule!, only: [:destroy] before_action :authorize_admin_pipeline_schedule!, only: [:destroy]
def index def index
......
...@@ -5,7 +5,7 @@ module Ci ...@@ -5,7 +5,7 @@ module Ci
def rules def rules
super super
if owned_by_developer? && pipeline_schedule.owner != user if owned_by_developer? && owned_by_another?
cannot! :update_pipeline_schedule cannot! :update_pipeline_schedule
end end
end end
...@@ -15,5 +15,9 @@ module Ci ...@@ -15,5 +15,9 @@ module Ci
def owned_by_developer? def owned_by_developer?
pipeline_schedule.project.team.developer?(user) pipeline_schedule.project.team.developer?(user)
end end
def owned_by_another?
!pipeline_schedule.owned_by?(user)
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment