Welcome to mirror list, hosted at ThFree Co, Russian Federation.

trigger_policy.rb « ci « policies « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 209db44539c9073092d0a0928e93ef7221dfcd29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

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
  end
end