Sha256: 9ad70f12178a9d5a874fd294cad359453d96426279cd4aeb3741d20cb4f7cead

Contents?: true

Size: 967 Bytes

Versions: 37

Compression:

Stored size: 967 Bytes

Contents

module Spree
  module Admin
    class RootController < Spree::Admin::BaseController
      skip_before_action :authorize_admin

      def index
        redirect_to admin_root_redirect_path
      end

      private

      def admin_root_redirect_path
        if can?(:display, Spree::Order) && can?(:admin, Spree::Order)
          spree.admin_orders_path
        elsif can?(:admin, :dashboards) && can?(:home, :dashboards)
          spree.home_admin_dashboards_path
        else
          # Invoke the unauthorized redirect, which will ideally go to the login controller
          # of the users chosen authorization implimentation. For devise this is /admin/login.
          #
          # This is done so devise redirects back to this controller, instead of the one specified
          # below, so this controller can use the user that is required for the path to
          # be calculated.
          raise CanCan::AccessDenied
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
solidus_backend-2.5.2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.5.1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.5.0 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.5.0.rc1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.5.0.beta2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.5.0.beta1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.4.2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.4.1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.3.1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.2.2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.1.1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.0.3 app/controllers/spree/admin/root_controller.rb
solidus_backend-1.4.2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.4.0 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.4.0.rc1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.4.0.beta1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.3.0 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.3.0.rc3 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.3.0.rc2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.3.0.rc1 app/controllers/spree/admin/root_controller.rb