diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 43063c62..f7f7a856 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,4 +23,13 @@ def rescue_can_can(exception) render file: "#{Rails.root}/public/403.html", status: :forbidden, layout: false end + + # Overriding CanCan::ControllerAdditions + def current_ability + @current_ability ||= ability_class.new(current_user) + end + + def ability_class + Settings.features.cocina ? CocinaAbility : Ability + end end