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

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

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

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

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