Sha256: 79a7b77715139210e3368e5009bef4d397578ef88e27475af57b3f1a8d0d2d03

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

module Adminpanel
    class ApplicationController < ActionController::Base
        protect_from_forgery

        inherit_resources

        include SessionsHelper
        include RestActionsHelper

        layout 'admin'

        before_filter :signed_in_user, :set_model

        rescue_from CanCan::AccessDenied do |exception|
          sign_out
          redirect_to signin_path, :alert => I18n.t('authentication.not_authorized')
        end

        def signed_in_user
            redirect_to signin_url, :notice => I18n.t("authentication.welcome") unless signed_in?
        end

        def set_model
            @model = params[:controller].classify.constantize
        end

        def handle_unverified_request
            sign_out
            super
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminpanel-1.2.12 app/controllers/adminpanel/application_controller.rb
adminpanel-1.2.11 app/controllers/adminpanel/application_controller.rb
adminpanel-1.2.10 app/controllers/adminpanel/application_controller.rb