From d94b1271d147fdb5bbd1e616e116173198e858db Mon Sep 17 00:00:00 2001 From: Vlatka Pavisic Date: Mon, 6 Feb 2017 11:42:12 +0100 Subject: Refs #2476 : Disable modification and deletion of resources from another referential; in progress --- app/controllers/connection_links_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app/controllers/connection_links_controller.rb') diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb index ca36a999f..abeb9dd6a 100644 --- a/app/controllers/connection_links_controller.rb +++ b/app/controllers/connection_links_controller.rb @@ -10,7 +10,9 @@ class ConnectionLinksController < ChouetteController respond_to :kml, :only => :show respond_to :js, :only => :index - def index + include PolicyChecker + + def index index! do |format| format.html { if collection.out_of_bounds? @@ -18,7 +20,7 @@ class ConnectionLinksController < ChouetteController end build_breadcrumb :index } - end + end end def show @@ -36,10 +38,10 @@ class ConnectionLinksController < ChouetteController end protected - + alias_method :connection_link, :resource - def collection + def collection @q = referential.connection_links.search(params[:q]) @connection_links ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page]) end @@ -53,7 +55,7 @@ class ConnectionLinksController < ChouetteController end private - + def connection_link_params params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs ) end -- cgit v1.2.3