aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/access_link_policy.rb
blob: 73b2d1baa22f43985c2e15bd1a0f07ae65f49864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class AccessLinkPolicy < ApplicationPolicy
  class Scope < Scope
    def resolve
      scope
    end
  end

  def create?
    user.has_permission?('access_links.create') # organisation match via referential is checked in the view
  end

  def edit?
    organisation_match? && user.has_permission?('access_links.edit')
  end

  def destroy?
    organisation_match? && user.has_permission?('access_links.destroy')
  end

  def update?  ; edit? end
  def new?     ; create? end
end