aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/boiv_policy.rb
blob: 9679d083a6c280f8b57d358fb377e8b25dcb308e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require_relative 'chain'
class BoivPolicy < ApplicationPolicy

  def boiv_read_offer?
    organisation_match? && user.has_permission?('boiv:read-offer')
  end

  def boiv?
    !(user.permissions || []).grep(%r{\Aboiv:.}).empty?
  end

  def index?
    boiv_read_offer?
  end

  def show?
    boiv_read_offer?
  end
end