Sha256: edae7d8acff940f2f207195fb5f18b057e131c5887fab6b49dd185d409cceb22

Contents?: true

Size: 877 Bytes

Versions: 14

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::SitemapActions
    include Adminpanel::GalleryActions

  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

14 entries across 14 versions & 1 rubygems

Version Path
adminpanel-3.6.1 app/controllers/adminpanel/application_controller.rb
adminpanel-3.6.0 app/controllers/adminpanel/application_controller.rb
adminpanel-3.5.1 app/controllers/adminpanel/application_controller.rb
adminpanel-3.5.0 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.7 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.6 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.5 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.4 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.3 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.2 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.1 app/controllers/adminpanel/application_controller.rb
adminpanel-3.4.0 app/controllers/adminpanel/application_controller.rb
adminpanel-3.3.4 app/controllers/adminpanel/application_controller.rb
adminpanel-3.3.3 app/controllers/adminpanel/application_controller.rb