Skip to content

Conversation

@adrian-martinez-interactiv4
Copy link
Contributor

Original Pull Request

#14886

Preconditions

Magento 2.2 have multiple admin user roles with access restrictions to some resources. Role has access to cart price rules, but it restricted to catalog rules rules.

Problem

When admin user with role mentioned above tried in edit/new cart price rule, in conditions settings add “SKU” condition, and then select products from loaded product grid – all grid navigation, sorting and filtering operations will lead to “403” redirect.

Reason
When magento loaded products grid for selecting product sku for cart price rules it use controller action which is inherited from similar one form CatalogRule module, this controller render its block Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku (which generate product grid HTML and JavaScript). This block method “getGridUrl” generates urls with route 'catalog_rule/*/chooser', so all requests for updating products grid data will lead to CatalogRule module controller. But current user has no access to CatalogRule routes so it get 403 response.



Solution

Modify method Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku::getGridUrl() method. Change route parameter which it pass in “getUrl” method from “catalog_rule//chooser” to “/*/chooser”.

…::getGridUrl() method. Route "module" part replaced by asterix symbol, which allow correct use this bock in "rules" logic in other modules (generate grid urls related to their own controllers which can fix some ACL conflicts).
@magento-engcom-team magento-engcom-team added this to the May 2018 milestone May 8, 2018
@magento-engcom-team magento-engcom-team added Release Line: 2.3 Partner: Interactiv4 Pull Request is created by partner Interactiv4 partners-contribution Pull Request is created by Magento Partner Progress: accept labels May 8, 2018
@magento-engcom-team magento-engcom-team merged commit 98e312f into magento:2.3-develop May 12, 2018
magento-engcom-team pushed a commit that referenced this pull request May 12, 2018
…min cart price rule edit page for user which has no access to CatalogRule module #15074
@magento-engcom-team
Copy link
Contributor

Hi @adrian-martinez-interactiv4. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Partner: Interactiv4 Pull Request is created by partner Interactiv4 partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants