diff options
| author | Robert | 2017-05-24 08:02:31 +0200 |
|---|---|---|
| committer | Robert | 2017-05-24 08:02:31 +0200 |
| commit | 571ce311bb44e5042189529cfb63bd09106ddc22 (patch) | |
| tree | a5efc848ed6cb21339468057ab9bb0871b075027 /app | |
| parent | d5063b73ff1e794d32a73d85880c541113fe29c6 (diff) | |
| download | chouette-core-571ce311bb44e5042189529cfb63bd09106ddc22.tar.bz2 | |
Refs: #3446; Applying to routes policy
Diffstat (limited to 'app')
| -rw-r--r-- | app/policies/boiv_policy.rb | 1 | ||||
| -rw-r--r-- | app/policies/line_policy.rb | 2 | ||||
| -rw-r--r-- | app/policies/route_policy.rb | 3 | ||||
| -rw-r--r-- | app/policies/time_table_policy.rb | 1 |
4 files changed, 5 insertions, 2 deletions
diff --git a/app/policies/boiv_policy.rb b/app/policies/boiv_policy.rb index 7f7534813..4270dc686 100644 --- a/app/policies/boiv_policy.rb +++ b/app/policies/boiv_policy.rb @@ -1,3 +1,4 @@ +require_relative 'chain' class BoivPolicy < ApplicationPolicy def boiv_read_offer? diff --git a/app/policies/line_policy.rb b/app/policies/line_policy.rb index 68c373c1e..c3e0051c8 100644 --- a/app/policies/line_policy.rb +++ b/app/policies/line_policy.rb @@ -27,7 +27,7 @@ class LinePolicy < BoivPolicy end def destroy_footnote? - user.has_permission?('routes.destroy') + user.has_permission?('footnotes.destroy') end def update_footnote? ; edit_footnote? end diff --git a/app/policies/route_policy.rb b/app/policies/route_policy.rb index ff13d3163..dba3a27da 100644 --- a/app/policies/route_policy.rb +++ b/app/policies/route_policy.rb @@ -1,10 +1,13 @@ class RoutePolicy < BoivPolicy + extend Policies::Chain class Scope < Scope def resolve scope end end + chain_policies :archived?, :!, policies: %i{create? destroy? edit?} + def create? user.has_permission?('routes.create') # organisation match via referential is checked in the view end diff --git a/app/policies/time_table_policy.rb b/app/policies/time_table_policy.rb index 4b2bf0cd9..efab6ac00 100644 --- a/app/policies/time_table_policy.rb +++ b/app/policies/time_table_policy.rb @@ -1,4 +1,3 @@ -require_relative 'chain' class TimeTablePolicy < BoivPolicy extend Policies::Chain |
