Skip to content

Commit f011437

Browse files
committed
Fix broken CMS Block listing page for admin users with limited permissions
Apply cms page-related changes only for `cms_page_listing_data_source`
1 parent 0ec7742 commit f011437

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

app/code/Magento/Cms/Ui/Component/DataProvider.php

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Magento\Ui\Component\Container;
1717

1818
/**
19-
* DataProvider for cms ui.
19+
* DataProvider for cms blocks and pages listing ui components.
2020
*/
2121
class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider
2222
{
@@ -107,38 +107,41 @@ public function prepareMetadata()
107107
{
108108
$metadata = [];
109109

110-
if (!$this->getAuthorizationInstance()->isAllowed('Magento_Cms::save')) {
111-
$metadata = [
112-
'cms_page_columns' => [
113-
'arguments' => [
114-
'data' => [
115-
'config' => [
116-
'editorConfig' => [
117-
'enabled' => false
118-
],
119-
'componentType' => Container::NAME
110+
if ($this->name === 'cms_page_listing_data_source') {
111+
112+
if (!$this->getAuthorizationInstance()->isAllowed('Magento_Cms::save')) {
113+
$metadata = [
114+
'cms_page_columns' => [
115+
'arguments' => [
116+
'data' => [
117+
'config' => [
118+
'editorConfig' => [
119+
'enabled' => false
120+
],
121+
'componentType' => Container::NAME
122+
]
120123
]
121124
]
122125
]
123-
]
124-
];
125-
}
126+
];
127+
}
126128

127-
if (!$this->getAuthorizationInstance()->isAllowed('Magento_Cms::save_design')) {
129+
if (!$this->getAuthorizationInstance()->isAllowed('Magento_Cms::save_design')) {
128130

129-
foreach ($this->pageLayoutColumns as $column) {
130-
$metadata['cms_page_columns']['children'][$column] = [
131-
'arguments' => [
132-
'data' => [
133-
'config' => [
134-
'editor' => [
135-
'editorType' => false
136-
],
137-
'componentType' => Container::NAME
131+
foreach ($this->pageLayoutColumns as $column) {
132+
$metadata['cms_page_columns']['children'][$column] = [
133+
'arguments' => [
134+
'data' => [
135+
'config' => [
136+
'editor' => [
137+
'editorType' => false
138+
],
139+
'componentType' => Container::NAME
140+
]
138141
]
139142
]
140-
]
141-
];
143+
];
144+
}
142145
}
143146
}
144147

0 commit comments

Comments
 (0)