Sha256: 8d58de08b6ab21c2161149a8088e88928325270a3b9b752a9591af17acf89b4b

Contents?: true

Size: 998 Bytes

Versions: 47

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

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

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend-2.8.4 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.8.3 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.7.2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.6.4 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.8.2 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.8.1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.6.3 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.8.0 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.7.1 app/controllers/spree/admin/root_controller.rb
solidus_backend-2.6.2 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.14 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.13 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.12 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.11 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.10 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.9 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.8 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.7 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.6 app/controllers/spree/admin/root_controller.rb
solidus_backend_devise_token_auth-2.8.0.alpha.5 app/controllers/spree/admin/root_controller.rb