aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/concerns/policy_checker.rb2
-rw-r--r--app/controllers/line_footnotes_controller.rb15
2 files changed, 12 insertions, 5 deletions
diff --git a/app/controllers/concerns/policy_checker.rb b/app/controllers/concerns/policy_checker.rb
index 9721dc63c..65a4428e2 100644
--- a/app/controllers/concerns/policy_checker.rb
+++ b/app/controllers/concerns/policy_checker.rb
@@ -2,7 +2,7 @@ module PolicyChecker
extend ActiveSupport::Concern
included do
- before_action :authorize_resource, only: [:destroy, :show, :update]
+ before_action :authorize_resource, only: [:destroy, :edit, :show, :update]
before_action :authorize_resource_class, only: [:create, :index, :new]
end
diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb
index f24d624d4..581c921e8 100644
--- a/app/controllers/line_footnotes_controller.rb
+++ b/app/controllers/line_footnotes_controller.rb
@@ -2,6 +2,9 @@ class LineFootnotesController < ChouetteController
defaults resource_class: Chouette::Line, collection_name: 'lines', instance_name: 'line'
belongs_to :referential
+ before_action :authorize_resource, only: [:destroy_footnote, :edit_footnote, :show_footnote, :update_footnote]
+ before_action :authorize_resource_class, only: [:create_footnote, :index_footnote, :new_footnote]
+
def edit
edit! do
build_breadcrumb :edit
@@ -17,13 +20,17 @@ class LineFootnotesController < ChouetteController
protected
- alias_method :line, :resource
-
- # overrides default
- def check_policy
+ protected
+ def authorize_resource
authorize resource, "#{action_name}_footnote?".to_sym
end
+ def authorize_resource_class
+ authorize resource_class, "#{action_name}_footnote?".to_sym
+ end
+
+ alias_method :line, :resource
+
def resource
@line ||= current_referential.lines.find params[:line_id]
end