BigW Consortium Gitlab

trigger_policy.rb 429 Bytes
Newer Older
1 2
module Ci
  class TriggerPolicy < BasePolicy
3 4 5 6 7 8 9 10 11 12 13 14
    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
15 16
  end
end