Skip to content

Commit bf8d430

Browse files
author
Yauhen_Lyskavets
committed
MC-16455: Admin user with permission for 1 store can manage categories
- Fix integration test.
1 parent 7482615 commit bf8d430

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/code/Magento/Catalog/Model/Category/DataProvider.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ public function getAttributesMeta(Type $entityType)
356356
$meta = [];
357357
$attributes = $entityType->getAttributeCollection();
358358
$fields = $this->getFields();
359+
$category = $this->getCurrentCategory();
359360
/* @var EavAttribute $attribute */
360361
foreach ($attributes as $attribute) {
361362
$code = $attribute->getAttributeCode();
@@ -382,11 +383,13 @@ public function getAttributesMeta(Type $entityType)
382383
$meta[$code]['componentType'] = Field::NAME;
383384

384385
// disable fields
385-
$attributeIsLocked = $this->getCurrentCategory()->isLockedAttribute($code);
386-
$meta[$code]['disabled'] = $attributeIsLocked;
387-
$hasUseConfigField = (bool) array_search('use_config.' . $code, $fields, true);
388-
if ($hasUseConfigField && $meta[$code]['disabled']) {
389-
$meta['use_config.' . $code]['disabled'] = true;
386+
if ($category) {
387+
$attributeIsLocked = $category->isLockedAttribute($code);
388+
$meta[$code]['disabled'] = $attributeIsLocked;
389+
$hasUseConfigField = (bool) array_search('use_config.' . $code, $fields, true);
390+
if ($hasUseConfigField && $meta[$code]['disabled']) {
391+
$meta['use_config.' . $code]['disabled'] = true;
392+
}
390393
}
391394
}
392395

0 commit comments

Comments
 (0)