2016-10-21 06:16:39 -04:00
|
|
|
module Ci
|
2017-04-12 06:19:39 -04:00
|
|
|
class PipelinePolicy < BasePolicy
|
2017-07-03 17:20:44 -04:00
|
|
|
delegate { @subject.project }
|
2017-07-03 17:01:05 -04:00
|
|
|
|
2017-07-03 17:15:27 -04:00
|
|
|
condition(:user_cannot_update) do
|
|
|
|
!::Gitlab::UserAccess
|
|
|
|
.new(@user, project: @subject.project)
|
|
|
|
.can_push_or_merge_to_branch?(@subject.ref)
|
2017-07-03 17:01:05 -04:00
|
|
|
end
|
|
|
|
|
2017-07-03 17:15:27 -04:00
|
|
|
rule { user_cannot_update }.prevent :update_pipeline
|
2016-10-21 06:16:39 -04:00
|
|
|
end
|
|
|
|
end
|