Sha256: baf2103c68c7b14def3f97de082768512a64576dfff3fd0b82cc3729ef83f603

Contents?: true

Size: 919 Bytes

Versions: 3

Compression:

Stored size: 919 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.0 app/controllers/adminpanel/application_controller.rb
adminpanel-2.3.1 app/controllers/adminpanel/application_controller.rb
adminpanel-2.3.0 app/controllers/adminpanel/application_controller.rb