Sha256: dbd999ee93b177b88552d77b6665a8facfc05c37dbfe3d7752840b812a5c7ef8

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

module Adminpanel
  class ApplicationController < ActionController::Base
    protect_from_forgery
    authorize_resource

    layout 'adminpanel/application'

    before_action :signed_in_user, :set_model

    include SessionsHelper
    include Adminpanel::RestActions
    include Adminpanel::SortableActions
    include Adminpanel::GalleryzableActions
    include Adminpanel::FacebookActions
    include Adminpanel::TwitterActions
    include Adminpanel::SitemapActions

  private
    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-2.4.3 app/controllers/adminpanel/application_controller.rb
adminpanel-2.4.2 app/controllers/adminpanel/application_controller.rb
adminpanel-2.4.1 app/controllers/adminpanel/application_controller.rb