From 68be20459b4c7a5cf6cc36a9e03b7a7d29b01430 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Thu, 23 Mar 2017 05:45:45 -0400 Subject: [PATCH] Added global_check_permission --- app/helpers/auth_helper.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 8b447e4..67cb3c2 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -31,6 +31,13 @@ module AuthHelper end end + + def global_check_permission(permission) + if !global_allowed_to?(permission) + render :file => "public/401.html.erb", :status => :unauthorized, :layout =>true + end + end + def global_allowed_to?( action) return false if User.current.nil?