diff options
Diffstat (limited to 'app/policies')
| -rw-r--r-- | app/policies/chouette/access_link_policy.rb | 30 | ||||
| -rw-r--r-- | app/policies/chouette/access_point_policy.rb | 30 | ||||
| -rw-r--r-- | app/policies/chouette/company_policy.rb | 14 | ||||
| -rw-r--r-- | app/policies/chouette/connection_link_policy.rb | 30 | ||||
| -rw-r--r-- | app/policies/chouette/group_of_line_policy.rb | 12 | ||||
| -rw-r--r-- | app/policies/chouette/journey_pattern_policy.rb | 31 | ||||
| -rw-r--r-- | app/policies/chouette/line_policy.rb | 36 | ||||
| -rw-r--r-- | app/policies/chouette/network_policy.rb | 12 | ||||
| -rw-r--r-- | app/policies/chouette/route_policy.rb | 34 | ||||
| -rw-r--r-- | app/policies/chouette/routing_constraint_zone_policy.rb | 30 | ||||
| -rw-r--r-- | app/policies/chouette/stop_area_policy.rb | 12 | ||||
| -rw-r--r-- | app/policies/chouette/time_table_policy.rb | 48 | ||||
| -rw-r--r-- | app/policies/chouette/vehicle_journey_policy.rb | 30 | 
13 files changed, 187 insertions, 162 deletions
| diff --git a/app/policies/chouette/access_link_policy.rb b/app/policies/chouette/access_link_policy.rb index bee7984c0..539262458 100644 --- a/app/policies/chouette/access_link_policy.rb +++ b/app/policies/chouette/access_link_policy.rb @@ -1,19 +1,21 @@ -class Chouette::AccessLinkPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class AccessLinkPolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('access_links.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('access_links.create') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('access_links.update') -  end +    def update? +      !archived? && organisation_match? && user.has_permission?('access_links.update') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('access_links.destroy') +    def destroy? +      !archived? && organisation_match? && user.has_permission?('access_links.destroy') +    end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/access_point_policy.rb b/app/policies/chouette/access_point_policy.rb index 6a570c812..2ecd971cd 100644 --- a/app/policies/chouette/access_point_policy.rb +++ b/app/policies/chouette/access_point_policy.rb @@ -1,19 +1,21 @@ -class Chouette::AccessPointPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class AccessPointPolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('access_points.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('access_points.create') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('access_points.update') -  end +    def update? +      !archived? && organisation_match? && user.has_permission?('access_points.update') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('access_points.destroy') +    def destroy? +      !archived? && organisation_match? && user.has_permission?('access_points.destroy') +    end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/company_policy.rb b/app/policies/chouette/company_policy.rb index 8fa22b5df..f2167b91e 100644 --- a/app/policies/chouette/company_policy.rb +++ b/app/policies/chouette/company_policy.rb @@ -1,7 +1,9 @@ -class Chouette::CompanyPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class CompanyPolicy < ApplicationPolicy +      class Scope < Scope +        def resolve +          scope +        end +      end      end -  end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/connection_link_policy.rb b/app/policies/chouette/connection_link_policy.rb index 65c4101f0..ac7b1746a 100644 --- a/app/policies/chouette/connection_link_policy.rb +++ b/app/policies/chouette/connection_link_policy.rb @@ -1,19 +1,21 @@ -class Chouette::ConnectionLinkPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class ConnectionLinkPolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('connection_links.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('connection_links.create') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('connection_links.destroy') -  end +    def destroy? +      !archived? && organisation_match? && user.has_permission?('connection_links.destroy') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('connection_links.update') +    def update? +      !archived? && organisation_match? && user.has_permission?('connection_links.update') +    end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/group_of_line_policy.rb b/app/policies/chouette/group_of_line_policy.rb index 9b4fbb4d8..f31107452 100644 --- a/app/policies/chouette/group_of_line_policy.rb +++ b/app/policies/chouette/group_of_line_policy.rb @@ -1,7 +1,9 @@ -class Chouette::GroupOfLinePolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class GroupOfLinePolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/journey_pattern_policy.rb b/app/policies/chouette/journey_pattern_policy.rb index 2fb1c9fd4..add28e0ca 100644 --- a/app/policies/chouette/journey_pattern_policy.rb +++ b/app/policies/chouette/journey_pattern_policy.rb @@ -1,21 +1,22 @@ -class Chouette::JourneyPatternPolicy < ApplicationPolicy +module Chouette +  class JourneyPatternPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('journey_patterns.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('journey_patterns.create') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('journey_patterns.destroy') -  end +    def destroy? +      !archived? && organisation_match? && user.has_permission?('journey_patterns.destroy') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('journey_patterns.update') +    def update? +      !archived? && organisation_match? && user.has_permission?('journey_patterns.update') +    end    end -end - +end
\ No newline at end of file diff --git a/app/policies/chouette/line_policy.rb b/app/policies/chouette/line_policy.rb index d07ad775c..678191ef7 100644 --- a/app/policies/chouette/line_policy.rb +++ b/app/policies/chouette/line_policy.rb @@ -1,23 +1,25 @@ -class Chouette::LinePolicy < ApplicationPolicy +module Chouette +  class LinePolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create_footnote? -    !archived? && organisation_match? && user.has_permission?('footnotes.create') -  end +    def create_footnote? +      !archived? && organisation_match? && user.has_permission?('footnotes.create') +    end -  def edit_footnote? -    !archived? && organisation_match? && user.has_permission?('footnotes.update') -  end +    def edit_footnote? +      !archived? && organisation_match? && user.has_permission?('footnotes.update') +    end -  def destroy_footnote? -    !archived? && organisation_match? && user.has_permission?('footnotes.destroy') -  end +    def destroy_footnote? +      !archived? && organisation_match? && user.has_permission?('footnotes.destroy') +    end -  def update_footnote?  ; edit_footnote? end -  def new_footnote?     ; create_footnote? end -end +    def update_footnote?  ; edit_footnote? end +    def new_footnote?     ; create_footnote? end +  end +end
\ No newline at end of file diff --git a/app/policies/chouette/network_policy.rb b/app/policies/chouette/network_policy.rb index faea4bb79..d792645b7 100644 --- a/app/policies/chouette/network_policy.rb +++ b/app/policies/chouette/network_policy.rb @@ -1,7 +1,9 @@ -class Chouette::NetworkPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class NetworkPolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/route_policy.rb b/app/policies/chouette/route_policy.rb index 5f467d98f..224d3c09e 100644 --- a/app/policies/chouette/route_policy.rb +++ b/app/policies/chouette/route_policy.rb @@ -1,23 +1,25 @@ -class Chouette::RoutePolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class RoutePolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('routes.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('routes.create') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('routes.destroy') -  end +    def destroy? +      !archived? && organisation_match? && user.has_permission?('routes.destroy') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('routes.update') -  end +    def update? +      !archived? && organisation_match? && user.has_permission?('routes.update') +    end -  def duplicate? -    create? +    def duplicate? +      create? +    end    end  end
\ No newline at end of file diff --git a/app/policies/chouette/routing_constraint_zone_policy.rb b/app/policies/chouette/routing_constraint_zone_policy.rb index 955ae21e6..ce08cfde5 100644 --- a/app/policies/chouette/routing_constraint_zone_policy.rb +++ b/app/policies/chouette/routing_constraint_zone_policy.rb @@ -1,19 +1,21 @@ -class Chouette::RoutingConstraintZonePolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class RoutingConstraintZonePolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('routing_constraint_zones.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('routing_constraint_zones.create') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('routing_constraint_zones.destroy') -  end +    def destroy? +      !archived? && organisation_match? && user.has_permission?('routing_constraint_zones.destroy') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('routing_constraint_zones.update') +    def update? +      !archived? && organisation_match? && user.has_permission?('routing_constraint_zones.update') +    end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/stop_area_policy.rb b/app/policies/chouette/stop_area_policy.rb index 75cbf15a3..1a34b3753 100644 --- a/app/policies/chouette/stop_area_policy.rb +++ b/app/policies/chouette/stop_area_policy.rb @@ -1,7 +1,9 @@ -class Chouette::StopAreaPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class StopAreaPolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/time_table_policy.rb b/app/policies/chouette/time_table_policy.rb index 2eb21ddf1..33a5f541a 100644 --- a/app/policies/chouette/time_table_policy.rb +++ b/app/policies/chouette/time_table_policy.rb @@ -1,32 +1,34 @@ -class Chouette::TimeTablePolicy < ApplicationPolicy +module Chouette +  class TimeTablePolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('time_tables.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('time_tables.create') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('time_tables.destroy') -  end +    def destroy? +      !archived? && organisation_match? && user.has_permission?('time_tables.destroy') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('time_tables.update') -  end +    def update? +      !archived? && organisation_match? && user.has_permission?('time_tables.update') +    end -  def actualize? -    !archived? && organisation_match? && edit? -  end +    def actualize? +      !archived? && organisation_match? && edit? +    end -  def duplicate? -    !archived? && organisation_match? && create? -  end +    def duplicate? +      !archived? && organisation_match? && create? +    end -  def month? -    update? +    def month? +      update? +    end    end -end +end
\ No newline at end of file diff --git a/app/policies/chouette/vehicle_journey_policy.rb b/app/policies/chouette/vehicle_journey_policy.rb index 646b0c07d..744c6f8d4 100644 --- a/app/policies/chouette/vehicle_journey_policy.rb +++ b/app/policies/chouette/vehicle_journey_policy.rb @@ -1,19 +1,21 @@ -class Chouette::VehicleJourneyPolicy < ApplicationPolicy -  class Scope < Scope -    def resolve -      scope +module Chouette +  class VehicleJourneyPolicy < ApplicationPolicy +    class Scope < Scope +      def resolve +        scope +      end      end -  end -  def create? -    !archived? && organisation_match? && user.has_permission?('vehicle_journeys.create') -  end +    def create? +      !archived? && organisation_match? && user.has_permission?('vehicle_journeys.create') +    end -  def destroy? -    !archived? && organisation_match? && user.has_permission?('vehicle_journeys.destroy') -  end +    def destroy? +      !archived? && organisation_match? && user.has_permission?('vehicle_journeys.destroy') +    end -  def update? -    !archived? && organisation_match? && user.has_permission?('vehicle_journeys.update') +    def update? +      !archived? && organisation_match? && user.has_permission?('vehicle_journeys.update') +    end    end -end +end
\ No newline at end of file | 
