debian-mirror-gitlab/app/policies/ci/trigger_policy.rb

18 lines
407 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module Ci
class TriggerPolicy < BasePolicy
2017-09-10 17:25:29 +05:30
delegate { @subject.project }
with_options scope: :subject, score: 0
with_score 0
condition(:is_owner) { @user && @subject.owner_id == @user.id }
rule { ~can?(:admin_build) }.prevent :admin_trigger
2020-03-13 15:44:24 +05:30
rule { is_owner }.enable :admin_trigger
2017-09-10 17:25:29 +05:30
rule { can?(:admin_build) }.enable :manage_trigger
2017-08-17 22:00:37 +05:30
end
end