diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php b/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php index a840498dfbf2b..f2039a5002dcc 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php @@ -40,6 +40,17 @@ public function getItems($attributeCode) */ public function add($attributeCode, $option) { + /** @var \Magento\Eav\Api\Data\AttributeOptionInterface[] $currentOptions */ + $currentOptions = $this->getItems($attributeCode); + if (is_array($currentOptions)) { + array_walk($currentOptions, function (&$attributeOption) { + /** @var \Magento\Eav\Api\Data\AttributeOptionInterface $attributeOption */ + $attributeOption = $attributeOption->getLabel(); + }); + if (in_array($option->getLabel(), $currentOptions)) { + return false; + } + } return $this->eavOptionManagement->add( \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, $attributeCode, diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php index a0c687bde1b47..d2ce1a58725a8 100644 --- a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php +++ b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php @@ -127,7 +127,10 @@ private function validateAclResource($dataProviderConfigData) { if (isset($dataProviderConfigData['aclResource'])) { if (!$this->_authorization->isAllowed($dataProviderConfigData['aclResource'])) { - $this->_redirect('admin/denied'); + if (!$this->_request->isAjax()) { + $this->_redirect('admin/denied'); + } + return false; } } diff --git a/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php b/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php index 7d5de26be6d2e..9e66d6a05f17b 100644 --- a/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php +++ b/app/code/Magento/Ui/Test/Unit/Controller/Adminhtml/Index/RenderTest.php @@ -279,6 +279,13 @@ public function testExecuteAjaxRequestWithoutPermissions(array $dataProviderConf $this->requestMock->expects($this->any()) ->method('getParams') ->willReturn([]); + if ($isAllowed === false) { + $this->requestMock->expects($this->once()) + ->method('isAjax') + ->willReturn(true); + } + $this->responseMock->expects($this->never()) + ->method('setRedirect'); $this->responseMock->expects($this->any()) ->method('appendBody') ->with($renderedData); diff --git a/app/design/frontend/Magento/blank/etc/view.xml b/app/design/frontend/Magento/blank/etc/view.xml index c0c40250158c0..8264e3111de88 100644 --- a/app/design/frontend/Magento/blank/etc/view.xml +++ b/app/design/frontend/Magento/blank/etc/view.xml @@ -12,9 +12,9 @@ 140 140 - - 152 - 188 + + 240 + 300 110 diff --git a/app/design/frontend/Magento/luma/etc/view.xml b/app/design/frontend/Magento/luma/etc/view.xml index f688c232b93c9..349224a34022c 100644 --- a/app/design/frontend/Magento/luma/etc/view.xml +++ b/app/design/frontend/Magento/luma/etc/view.xml @@ -12,9 +12,9 @@ 140 140 - - 200 - 248 + + 240 + 300 165