Sha256: 0a895294b21fa034d7e7e0c9297061411353dcaa75d4c27de87dbaf2f76c93f2
Contents?: true
Size: 889 Bytes
Versions: 5
Compression:
Stored size: 889 Bytes
Contents
module Spree::Auth::Admin::BaseControllerDecorator # Redirect as appropriate when an access request fails. The default action is to redirect to the login screen. # Override this method in your controllers if you want to have special behavior in case the user is not authorized # to access the requested action. For example, a popup window might simply close itself. def unauthorized if try_spree_current_user flash[:error] = Spree.t(:authorization_failure) redirect_to spree.admin_unauthorized_path else store_location redirect_to spree.admin_login_path end end protected def model_class const_name = controller_name.classify if Spree.const_defined?(const_name, false) return "Spree::#{const_name}".constantize end nil end end ::Spree::Admin::BaseController.prepend(Spree::Auth::Admin::BaseControllerDecorator)
Version data entries
5 entries across 5 versions & 1 rubygems