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

  def create?
    !referential_read_only? && organisation_match? && user.has_permission?('routes.create')
  end

  def destroy?
    !referential_read_only? && organisation_match? && user.has_permission?('routes.destroy')
  end

  def update?
    !referential_read_only? && organisation_match? && user.has_permission?('routes.update')
  end

  def duplicate?
    create?
  end
end