-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new access denied extension point. #12
Conversation
👍 |
i'm not a huge fan of this, can we find another way to decorate solidus? |
Class attribute added in solidusio/solidus#179 allows us to more easily define the behaviour we want for the extension.
@athal7: Updated to hook into Solidus a bit nicer. What do you think? Tests will fail until solidusio/solidus#179 is merged. Running locally everything is green. |
return "Spree::#{const_name}".constantize | ||
end | ||
nil | ||
def model_class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm still curious why this is here as opposed to in core, though that's not central to what you're doing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither am I. Wanted to limit the number of changes in this pull-request so I didn't spend any time looking into whether this is even necessary.
looks great! |
👍 |
Use new access denied extension point.
Writing # GET /admin/orders
Spree::BaseController.unauthorized_redirect = -> { redirect_to main_app.root_path }
Spee::BaseController.class_eval do
unauthorized_redirect = -> do
redirect_to main_app.root_path
end
def self.unauthorized_redirect
-> { redirect_to main_app.root_path }
end
end
Spree::Admin::BaseController.unauthorized_redirect = -> { redirect_to main_app.root_path }
Spee::Admin::BaseController.class_eval do
unauthorized_redirect = -> do
redirect_to main_app.root_path
end
def self.unauthorized_redirect
-> { redirect_to main_app.root_path }
end
end
# => GET /admin/login None of these worked for me, however, using
|
Note to self and to anyone stumbling across via Google, don't forget to use Spee::Admin::BaseController.class_eval do
self.unauthorized_redirect = -> { ... }
end |
Class attribute added in solidusio/solidus#179 allows us to more easily define the behaviour we want for the extension.