From fd9cd712f8e32378bdee5f049db2a0fe034a9b2a Mon Sep 17 00:00:00 2001 From: Xinhui Date: Wed, 19 Apr 2017 15:35:13 +0200 Subject: Refactoring Pundit ApplicationPolicy with UserContext Refs #3140 --- app/controllers/application_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c2414f5bb..2bdf8078a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,6 +15,10 @@ class ApplicationController < ActionController::Base I18n.locale = session[:language] || I18n.default_locale end + def pundit_user + UserContext.new(current_user, referential: self.try(:current_referential)) + end + protected def user_not_authorized -- cgit v1.2.3