You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when the authorization failures come from exceptions from CanCan's authorize! method, spree calls a method named redirect_unauthorized_access. So if you access certain backend features, you might be redirected to the frontend login instead.
Maybe a alias_method :redirect_unauthorized_access, :unauthorized in the admin_controller_decorator would already fix this.
The text was updated successfully, but these errors were encountered:
bxt
changed the title
CanCan auth fails redirect from backend to frontend login path
CanCan auth-fails redirect from backend to frontend login path
Dec 5, 2016
I guess we have some custom controllers that only inherit from Spree::Admin::BaseController, so they don't get this patch, but they still use CanCan. Maybe it would be better to override the rescue_from in Spree::Admin::BaseController since this is the topmost admin controller which also includes CanCan stuff via Spree::BaseController from core and its concern Spree::Core::ControllerHelpers::Auth.
So spree_auth_devise already patches
Spree::Admin::BaseController#unauthorized
such that unauthorized actions go to the backend login form.However, when the authorization failures come from exceptions from CanCan's
authorize!
method, spree calls a method namedredirect_unauthorized_access
. So if you access certain backend features, you might be redirected to the frontend login instead.Maybe a
alias_method :redirect_unauthorized_access, :unauthorized
in the admin_controller_decorator would already fix this.The text was updated successfully, but these errors were encountered: