Sha256: 6b64f6bc7b6f386f6ac23f495b431126b929b9ab5916bc96c1ffa85e300f45c7

Contents?: true

Size: 678 Bytes

Versions: 4

Compression:

Stored size: 678 Bytes

Contents

module Guts
  # Main inherited controller class
  # @abstract
  class ApplicationController < ActionController::Base
    include SessionsHelper
    
    protect_from_forgery with: :exception
    
    before_action :firewall
    
    private
    # Checks if a user is logged in and an admin
    # If they are not, they are redirected to login
    # @private
    # @note This is a `before_action` method
    def firewall
      unless params[:controller].include? "session"
        redirect_to new_session_path unless logged_in? and (Guts.configuration.admin_groups.size && (current_user.groups.map(&:title) & Guts.configuration.admin_groups).size > 0)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guts-1.0.8 app/controllers/guts/application_controller.rb
guts-1.0.7 app/controllers/guts/application_controller.rb
guts-1.0.5 app/controllers/guts/application_controller.rb
guts-1.0.3 app/controllers/guts/application_controller.rb