aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorXinhui2017-04-19 15:35:13 +0200
committerXinhui2017-04-19 15:36:46 +0200
commitfd9cd712f8e32378bdee5f049db2a0fe034a9b2a (patch)
treed40b8072bf5ca8425f71c1ed4459833940742c1e /app/controllers/application_controller.rb
parenta1c1d659a984d05799812c92a53925337f361930 (diff)
downloadchouette-core-fd9cd712f8e32378bdee5f049db2a0fe034a9b2a.tar.bz2
Refactoring Pundit ApplicationPolicy with UserContext
Refs #3140
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb4
1 files changed, 4 insertions, 0 deletions
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