module FatModelAuth::ControllerHelpers
Protected Instance Methods
access_denied?()
click to toggle source
# File lib/fat_model_auth/controller_helpers.rb, line 14 def access_denied? authority = get_authority access_granted = authority.allows(current_user).send "to_#{params[:action]}?" if access_granted false else respond_with_404_page true end end
auth_required()
click to toggle source
# File lib/fat_model_auth/controller_helpers.rb, line 7 def auth_required authority = get_authority access_granted = authority.allows(current_user).send "to_#{params[:action]}?" respond_with_404_page unless access_granted end
Private Instance Methods
respond_with_404_page()
click to toggle source
# File lib/fat_model_auth/controller_helpers.rb, line 41 def respond_with_404_page if defined?(Rails) render file: "#{Rails.root}/public/404.html", status: 404, layout: false else render nothing: true, status: 404, layout: false end end