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

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

class ResourceLabelEventPolicy < BasePolicy
  condition(:can_read_label) { @subject.label_id.nil? || can?(:read_label, @subject.label) }
  condition(:can_read_issuable) { can?(:"read_#{@subject.issuable.to_ability_name}", @subject.issuable) }

  rule { can_read_label }.policy do
    enable :read_label
  end

  rule { can_read_label & can_read_issuable }.policy do
    enable :read_resource_label_event
  end
end