Sha256: 6a08b61e65b93464500cf39202ee59a6725c95f9788b4d0c42d4a9da0c554719

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module EacRailsBase0
  class ApplicationController < ActionController::Base
    include ::CanCanDry::ControllerAuthorization

    layout 'eac_rails_base0/application'
    helper ::EacRailsBase0::AppVersionHelper
    helper ::EacRailsBase0::LayoutHelper
    helper ::EacRailsUtils::FormatterHelper
    helper ::EacRailsUtils::LinksHelper
    helper ::EacRailsUtils::OpenGraphProtocolHelper

    # Prevent CSRF attacks by raising an exception.
    # For APIs, you may want to use :null_session instead.
    protect_from_forgery with: :exception

    before_action :authorize_by_ability_mapping

    rescue_from CanCan::AccessDenied do |exception|
      if current_user
        flash[:error] = "Conteúdo indisponível: #{exception}"
        redirect_to main_app.root_url
      else
        flash[:danger] = 'Por favor faça o login.'
        store_location_for(::EacUsersSupport::User, request.fullpath)
        redirect_to eac_users_support.new_user_session_path
      end
    end

    class << self
      def active_scaffold_controller_for(klass)
        return ::EacUsersSupport::Admin::UsersController if klass == ::EacUsersSupport::User

        super
      end
    end

    def after_sign_in_path_for(resource)
      stored_location_for(resource) || root_path
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
eac_rails_base0-0.48.1 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.48.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.47.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.46.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.45.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.44.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.43.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.42.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.41.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.40.1 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.40.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.39.1 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.39.0 app/controllers/eac_rails_base0/application_controller.rb