-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix broken CMS Block listing page for admin users with limited permissions #39666
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
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @ihor-sviziev. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
a25fe43
to
4c7d8c2
Compare
@magento run all tests |
@magento run Functional Tests B2B |
…sions Apply cms page-related changes only for `cms_page_listing_data_source`
…sions Improve test
…sions Add test coverage
64c5208
to
9fd3712
Compare
@magento run all tests |
Thanks @ihor-sviziev! A client of ours ran into the same problem a couple of days ago and I can confirm that this change fixes it. It looks good to me. Let's hope Adobe will include it in the next security releases, as this is a regression bug which was introduced in the previous security releases. |
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.
Pull Request Overview
This pull request fixes a bug in the CMS Block listing page for admin users with limited permissions by ensuring that CMS page–specific code runs only when the datasource is for CMS pages. Key changes include:
- Adding a conditional check in the DataProvider to run CMS page logic only for 'cms_page_listing_data_source'.
- Updating unit tests to use createMock and adding a test for the CMS block listing datasource.
- Adjusting type hints and use statements to work with AuthorizationInterface.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
app/code/Magento/Cms/Ui/Component/DataProvider.php | Added a guard clause in prepareMetadata to limit CMS page logic. |
app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/DataProviderTest.php | Updated mocks and added a new test for CMS block listing datasource. |
Comments suppressed due to low confidence (1)
app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/DataProviderTest.php:126
- The test expects two isAllowed calls, but the updated DataProvider logic only invokes one call for CMS page datasource. Consider updating the expectation to match the new conditional behavior.
$this->authorizationMock->expects($this->exactly(2))
…ork-for-admin-users-with-limited-permissions
@magento run all tests |
The
Magento\Cms\Ui\Component\DataProvider
is designed both forcms_page_listing_data_source
andcms_block_listing_data_source
. However, currently in theprepareMetadata
method, we have cms-page-only code, and this code actually causing failure.This pull request adds check, so that cms-page-related code is executed only when the related datasource is currently used.
Description (*)
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)