From 894ee9abfdf63f5f22804dc473faede867ac308c Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Thu, 23 Mar 2017 05:33:58 -0400 Subject: [PATCH] added check_permission --- app/helpers/auth_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 53a2f90..8b447e4 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -25,6 +25,12 @@ module AuthHelper false end + def check_permission(permission) + if !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?