Skip to content

Commit 60b927d

Browse files
author
OlgaVasyltsun
committed
MAGETWO-98202: Additional Permissions for Design settings
1 parent 0cf3754 commit 60b927d

File tree

4 files changed

+37
-13
lines changed

4 files changed

+37
-13
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -651,19 +651,19 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC
651651
}
652652

653653
//Checking access to design config.
654-
if (in_array($attributeCode, $this->designAttributeCodes, true)) {
655-
if (!$this->authorization->isAllowed('Magento_Catalog::edit_product_design')) {
656-
$meta = $this->arrayManager->merge(
657-
$configPath,
658-
$meta,
659-
[
660-
'disabled' => true,
661-
'validation' => ['required' => false],
662-
'required' => false,
663-
'serviceDisabled' => true,
664-
]
665-
);
666-
}
654+
if (in_array($attributeCode, $this->designAttributeCodes, true)
655+
&& !$this->authorization->isAllowed('Magento_Catalog::edit_product_design')
656+
) {
657+
$meta = $this->arrayManager->merge(
658+
$configPath,
659+
$meta,
660+
[
661+
'disabled' => true,
662+
'validation' => ['required' => false],
663+
'required' => false,
664+
'serviceDisabled' => true,
665+
]
666+
);
667667
}
668668

669669
return $meta;

dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Backend\Model\Auth;
1010
use Magento\Catalog\Api\CategoryRepositoryInterface;
1111
use Magento\Framework\Acl\Builder;
12+
use Magento\Framework\Acl\CacheInterface;
1213
use Magento\TestFramework\Helper\Bootstrap;
1314
use Magento\TestFramework\Bootstrap as TestBootstrap;
1415

@@ -34,6 +35,11 @@ class CategoryRepositoryTest extends \PHPUnit_Framework_TestCase
3435
*/
3536
private $aclBuilder;
3637

38+
/**
39+
* @var CacheInterface
40+
*/
41+
private $aclCache;
42+
3743
/**
3844
* Sets up common objects.
3945
*
@@ -44,6 +50,7 @@ protected function setUp()
4450
$this->repository = Bootstrap::getObjectManager()->create(CategoryRepositoryInterface::class);
4551
$this->authorization = Bootstrap::getObjectManager()->get(Auth::class);
4652
$this->aclBuilder = Bootstrap::getObjectManager()->get(Builder::class);
53+
$this->aclCache = Bootstrap::getObjectManager()->get(CacheInterface::class);
4754
}
4855

4956
/**
@@ -54,6 +61,7 @@ protected function tearDown()
5461
parent::tearDown();
5562

5663
$this->authorization->logout();
64+
$this->aclCache->clean();
5765
}
5866

5967
/**

dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\TestFramework\Helper\Bootstrap;
1212
use Magento\TestFramework\Bootstrap as TestBootstrap;
1313
use Magento\Framework\Acl\Builder;
14+
use Magento\Framework\Acl\CacheInterface;
1415

1516
/**
1617
* Provide tests for ProductRepository model.
@@ -37,6 +38,11 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase
3738
*/
3839
private $aclBuilder;
3940

41+
/**
42+
* @var CacheInterface
43+
*/
44+
private $aclCache;
45+
4046
/**
4147
* @inheritdoc
4248
*/
@@ -45,6 +51,7 @@ protected function setUp()
4551
$this->productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
4652
$this->authorization = Bootstrap::getObjectManager()->get(Auth::class);
4753
$this->aclBuilder = Bootstrap::getObjectManager()->get(Builder::class);
54+
$this->aclCache = Bootstrap::getObjectManager()->get(CacheInterface::class);
4855
}
4956

5057
/**
@@ -55,6 +62,7 @@ protected function tearDown()
5562
parent::tearDown();
5663

5764
$this->authorization->logout();
65+
$this->aclCache->clean();
5866
}
5967

6068
/**

dev/tests/integration/testsuite/Magento/Cms/Model/PageRepositoryTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Api\SearchCriteriaBuilder;
1414
use Magento\TestFramework\Bootstrap as TestBootstrap;
1515
use Magento\TestFramework\Helper\Bootstrap;
16+
use Magento\Framework\Acl\CacheInterface;
1617

1718
/**
1819
* Test class for page repository.
@@ -46,6 +47,11 @@ class PageRepositoryTest extends \PHPUnit_Framework_TestCase
4647
*/
4748
private $pageCollectionFactory;
4849

50+
/**
51+
* @var CacheInterface
52+
*/
53+
private $aclCache;
54+
4955
/**
5056
* Sets up common objects.
5157
*
@@ -58,6 +64,8 @@ protected function setUp()
5864
$this->criteriaBuilder = Bootstrap::getObjectManager()->get(SearchCriteriaBuilder::class);
5965
$this->aclBuilder = Bootstrap::getObjectManager()->get(Builder::class);
6066
$this->pageCollectionFactory = Bootstrap::getObjectManager()->get(PageCollectionFactory::class);
67+
$this->aclCache = Bootstrap::getObjectManager()->get(CacheInterface::class);
68+
$this->aclCache->clean();
6169
}
6270

6371
/**

0 commit comments

Comments
 (0)