Skip to content
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

Set model_class on admin promotion rules controller #2623

Merged

Conversation

luukveenis
Copy link

If a user has the PromotionManagement permission set, they are currently unable to add new promotion rules to promotions.

This is happening because the promotion rules controller doesn't inherit from the Spree::Admin::ResourceController, so if it doesn't respond to :model_class, it will try to authorize using controller_name.to_sym instead of the correct class constant.

https://github.com/solidusio/solidus/blob/master/backend/app/controllers/spree/admin/base_controller.rb#L21

If a user has the `PromotionManagement` permission set, they are
currently unable to add new promotion rules to promotions.

This is happening because the promotion rules controller doesn't inherit
from the `ResourceController`, so if it doesn't respond to
`:model_class`, it will try to authorize using `controller_name.to_sym`
instead of the correct class constant.
Copy link
Contributor

@jhawthorn jhawthorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Luuk

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Thanks

@kennyadsl kennyadsl merged commit 9d408ef into solidusio:master Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants