aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/journey_pattern_policy.rb
blob: 9d13624c5fac7f42b385a15d8c565d87a2558e6a (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 < BoivPolicy
  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