Sha256: d2fb1616fcb470d2803562ea131ea0151bb2fd0cc3026152d4cc976d2d5f685c

Contents?: true

Size: 877 Bytes

Versions: 8

Compression:

Stored size: 877 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::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

8 entries across 8 versions & 1 rubygems

Version Path
adminpanel-2.6.1 app/controllers/adminpanel/application_controller.rb
adminpanel-2.6.0 app/controllers/adminpanel/application_controller.rb
adminpanel-2.5.5 app/controllers/adminpanel/application_controller.rb
adminpanel-2.5.4 app/controllers/adminpanel/application_controller.rb
adminpanel-2.5.3 app/controllers/adminpanel/application_controller.rb
adminpanel-2.5.2 app/controllers/adminpanel/application_controller.rb
adminpanel-2.5.1 app/controllers/adminpanel/application_controller.rb
adminpanel-2.5.0 app/controllers/adminpanel/application_controller.rb