aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/line_footnotes_controller.rb2
-rw-r--r--app/controllers/vehicle_journeys_controller.rb10
2 files changed, 2 insertions, 10 deletions
diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb
index 7bc048731..c42aa785b 100644
--- a/app/controllers/line_footnotes_controller.rb
+++ b/app/controllers/line_footnotes_controller.rb
@@ -1,7 +1,6 @@
class LineFootnotesController < BreadcrumbController
defaults :resource_class => Chouette::Line
include PolicyChecker
- before_action :check_policy, only: [:edit, :update, :destroy]
respond_to :json, :only => :show
belongs_to :referential
@@ -27,7 +26,6 @@ class LineFootnotesController < BreadcrumbController
end
protected
-
# overrides default
def check_policy
authorize resource, "#{action_name}_footnote?".to_sym
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index d45f4d1af..c084b592a 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -1,6 +1,5 @@
class VehicleJourneysController < ChouetteController
defaults :resource_class => Chouette::VehicleJourney
- before_action :check_policy, only: [:edit, :update, :destroy]
before_action :user_permissions, only: :index
respond_to :json, :only => :index
@@ -130,17 +129,12 @@ class VehicleJourneysController < ChouetteController
@matrix = resource_class.matrix(@vehicle_journeys)
end
- def check_policy
- authorize resource
- end
-
def user_permissions
@perms = {}.tap do |perm|
['vehicle_journeys.create', 'vehicle_journeys.edit', 'vehicle_journeys.destroy'].each do |name|
- perm[name] = current_user.permissions.include?(name)
+ perm[name] = policy(:vehicle_journey).send("#{name.split('.').last}?")
end
- end
- @perms = @perms.to_json
+ end.to_json
end
private