-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add ACL role ID to category tree cache id #27429
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
Add ACL role ID to category tree cache id #27429
Conversation
Hi @quangdo-aligent. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
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.
it's good
Hello @quangdo-aligent first of all, thanks for your contribution, this seems to be a nasty bug. Due to Magento Definition of Done, all code must be covered by tests. For this specific case, you should cover your fix by automated tests with the scenario which leads to an issue. Tests should fail on the mainline and pass with your fix. To answer the question "which kind of tests should I write", the answer is: In Magento codebase, you already find two kinds of test for this class:
So my suggestion would be to try with a unit test. Thank you again! |
@magento run all tests |
Hello @quangdo-aligent can you please check why some tests fail? |
@magento run all tests |
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.
Hi @quangdo-aligent all tests passed, well done!
Hi @aleron75, thank you for the review. |
… fix/admin-category-tree-cache-key � Conflicts: � app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php
@magento create issue |
Hi @slavvka, thank you for the review. |
✔️ QA Passed |
Hi @quangdo-aligent, thank you for your contribution! |
Related Pull Requests
Description (*)
When an admin user views a product's category tree (by editing a product), the category tree is cached with an ID akin to
CATALOG_PRODUCT_CATEGORY_TREE_0_
(the$filter
option is not used in the Magento codebase).This is not compatible with admin users that have limited Role Scopes. If the first admin user to view a product category tree has access to all websites (e.g.
Administrator
), this then caches the full category tree for all websites. Then the limited admin user will also see this full category tree even if they should be limited to a single website's category tree. Similarly, if the limited admin user views the category tree after the block cache is cleaned, theAdministrator
user will only see a limited category tree.This pull request adds the admin's user's ACL role ID to the cache ID. This is probably about as performant as we can get.
Manual testing scenarios (*)
block_html
cache and view a product's category tree as anAdministrator
admin user.Contribution checklist (*)
Resolved issues: