gitlab-org--gitlab-foss/app/policies/ci/trigger_policy.rb

17 lines
429 B
Ruby
Raw Normal View History

2017-03-07 08:02:56 -05:00
module Ci
class TriggerPolicy < BasePolicy
delegate { @subject.project }
with_options scope: :subject, score: 0
condition(:legacy) { @subject.legacy? }
with_score 0
condition(:is_owner) { @user && @subject.owner_id == @user.id }
rule { ~can?(:admin_build) }.prevent :admin_trigger
rule { legacy | is_owner }.enable :admin_trigger
rule { can?(:admin_build) }.enable :manage_trigger
2017-03-07 08:02:56 -05:00
end
end