diff --git a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/TrackingScriptTest.xml b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/TrackingScriptTest.xml
deleted file mode 100644
index e02c34fd8868e..0000000000000
--- a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/TrackingScriptTest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php b/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php
index 9eb9ffb806c9f..b877b2cca67a5 100644
--- a/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php
+++ b/app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php
@@ -7,7 +7,10 @@
namespace Magento\Customer\Model\Plugin;
use Magento\Authorization\Model\UserContextInterface;
+use Magento\Customer\Model\CustomerFactory;
+use Magento\Customer\Model\ResourceModel\Customer as CustomerResource;
use Magento\Integration\Api\AuthorizationServiceInterface as AuthorizationService;
+use Magento\Store\Model\StoreManagerInterface;
/**
* Plugin around \Magento\Framework\Authorization::isAllowed
@@ -19,16 +22,41 @@ class CustomerAuthorization
/**
* @var UserContextInterface
*/
- protected $userContext;
+ private $userContext;
+
+ /**
+ * @var CustomerFactory
+ */
+ private $customerFactory;
+
+ /**
+ * @var CustomerResource
+ */
+ private $customerResource;
+
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
/**
* Inject dependencies.
*
* @param UserContextInterface $userContext
+ * @param CustomerFactory $customerFactory
+ * @param CustomerResource $customerResource
+ * @param StoreManagerInterface $storeManager
*/
- public function __construct(UserContextInterface $userContext)
- {
+ public function __construct(
+ UserContextInterface $userContext,
+ CustomerFactory $customerFactory,
+ CustomerResource $customerResource,
+ StoreManagerInterface $storeManager
+ ) {
$this->userContext = $userContext;
+ $this->customerFactory = $customerFactory;
+ $this->customerResource = $customerResource;
+ $this->storeManager = $storeManager;
}
/**
@@ -53,9 +81,15 @@ public function aroundIsAllowed(
&& $this->userContext->getUserId()
&& $this->userContext->getUserType() === UserContextInterface::USER_TYPE_CUSTOMER
) {
- return true;
- } else {
- return $proceed($resource, $privilege);
+ $customer = $this->customerFactory->create();
+ $this->customerResource->load($customer, $this->userContext->getUserId());
+ $currentStoreId = $this->storeManager->getStore()->getId();
+ $sharedStoreIds = $customer->getSharedStoreIds();
+ if (in_array($currentStoreId, $sharedStoreIds)) {
+ return true;
+ }
}
+
+ return $proceed($resource, $privilege);
}
}
diff --git a/app/code/Magento/MediaContentCatalog/Observer/CategoryDelete.php b/app/code/Magento/MediaContentCatalog/Observer/CategoryDelete.php
new file mode 100644
index 0000000000000..1565d455cc43f
--- /dev/null
+++ b/app/code/Magento/MediaContentCatalog/Observer/CategoryDelete.php
@@ -0,0 +1,120 @@
+extractAssetsFromContent = $extractAssetsFromContent;
+ $this->getContent = $getContent;
+ $this->deleteContentAssetLinks = $deleteContentAssetLinks;
+ $this->contentAssetLinkFactory = $contentAssetLinkFactory;
+ $this->contentIdentityFactory = $contentIdentityFactory;
+ $this->fields = $fields;
+ }
+
+ /**
+ * Retrieve the deleted category and remove relation betwen category and asset
+ *
+ * @param Observer $observer
+ * @throws \Exception
+ */
+ public function execute(Observer $observer): void
+ {
+ $category = $observer->getEvent()->getData('category');
+ $contentAssetLinks = [];
+
+ if ($category instanceof CatalogCategory) {
+ foreach ($this->fields as $field) {
+ $contentIdentity = $this->contentIdentityFactory->create(
+ [
+ self::TYPE => self::CONTENT_TYPE,
+ self::FIELD => $field,
+ self::ENTITY_ID => (string) $category->getEntityId(),
+ ]
+ );
+ $content = implode(PHP_EOL, $this->getContent->execute($contentIdentity));
+ $assets = $this->extractAssetsFromContent->execute($content);
+
+ foreach ($assets as $asset) {
+ $contentAssetLinks[] = $this->contentAssetLinkFactory->create(
+ [
+ 'assetId' => $asset->getId(),
+ 'contentIdentity' => $contentIdentity
+ ]
+ );
+ }
+ }
+ if (!empty($contentAssetLinks)) {
+ $this->deleteContentAssetLinks->execute($contentAssetLinks);
+ }
+ }
+ }
+}
diff --git a/app/code/Magento/MediaContentCatalog/Observer/ProductDelete.php b/app/code/Magento/MediaContentCatalog/Observer/ProductDelete.php
new file mode 100644
index 0000000000000..421bb5a33fa1d
--- /dev/null
+++ b/app/code/Magento/MediaContentCatalog/Observer/ProductDelete.php
@@ -0,0 +1,120 @@
+extractAssetsFromContent = $extractAssetsFromContent;
+ $this->getContent = $getContent;
+ $this->deleteContentAssetLinks = $deleteContentAssetLinks;
+ $this->contentAssetLinkFactory = $contentAssetLinkFactory;
+ $this->contentIdentityFactory = $contentIdentityFactory;
+ $this->fields = $fields;
+ }
+
+ /**
+ * Retrieve the deleted product and remove relation betwen product and asset
+ *
+ * @param Observer $observer
+ * @throws \Exception
+ */
+ public function execute(Observer $observer): void
+ {
+ $product = $observer->getEvent()->getData('product');
+ $contentAssetLinks = [];
+
+ if ($product instanceof CatalogProduct) {
+ foreach ($this->fields as $field) {
+ $contentIdentity = $this->contentIdentityFactory->create(
+ [
+ self::TYPE => self::CONTENT_TYPE,
+ self::FIELD => $field,
+ self::ENTITY_ID => (string) $product->getEntityId(),
+ ]
+ );
+ $productContent = implode(PHP_EOL, $this->getContent->execute($contentIdentity));
+ $assets = $this->extractAssetsFromContent->execute($productContent);
+
+ foreach ($assets as $asset) {
+ $contentAssetLinks[] = $this->contentAssetLinkFactory->create(
+ [
+ 'assetId' => $asset->getId(),
+ 'contentIdentity' => $contentIdentity
+ ]
+ );
+ }
+ }
+ if (!empty($contentAssetLinks)) {
+ $this->deleteContentAssetLinks->execute($contentAssetLinks);
+ }
+ }
+ }
+}
diff --git a/app/code/Magento/MediaContentCatalog/etc/di.xml b/app/code/Magento/MediaContentCatalog/etc/di.xml
index a2d300a2bb208..6b0ee83b30788 100644
--- a/app/code/Magento/MediaContentCatalog/etc/di.xml
+++ b/app/code/Magento/MediaContentCatalog/etc/di.xml
@@ -14,6 +14,22 @@
+
+
+
+ - description
+ - short_description
+
+
+
+
+
+
+ - image
+ - description
+
+
+
diff --git a/app/code/Magento/MediaContentCatalog/etc/events.xml b/app/code/Magento/MediaContentCatalog/etc/events.xml
index f68d66eb3cc40..8ec7a30b961ba 100644
--- a/app/code/Magento/MediaContentCatalog/etc/events.xml
+++ b/app/code/Magento/MediaContentCatalog/etc/events.xml
@@ -9,6 +9,12 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaContentCms/Observer/BlockDelete.php b/app/code/Magento/MediaContentCms/Observer/BlockDelete.php
new file mode 100644
index 0000000000000..582f0a9ec6701
--- /dev/null
+++ b/app/code/Magento/MediaContentCms/Observer/BlockDelete.php
@@ -0,0 +1,119 @@
+extractAssetsFromContent = $extractAssetsFromContent;
+ $this->getContent = $getContent;
+ $this->deleteContentAssetLinks = $deleteContentAssetLinks;
+ $this->contentAssetLinkFactory = $contentAssetLinkFactory;
+ $this->contentIdentityFactory = $contentIdentityFactory;
+ $this->fields = $fields;
+ }
+
+ /**
+ * Retrieve the deleted category and remove relation betwen category and asset
+ *
+ * @param Observer $observer
+ * @throws \Exception
+ */
+ public function execute(Observer $observer): void
+ {
+ $block = $observer->getEvent()->getData('object');
+ $contentAssetLinks = [];
+
+ if ($block instanceof CmsBlock) {
+ foreach ($this->fields as $field) {
+ $contentIdentity = $this->contentIdentityFactory->create(
+ [
+ self::TYPE => self::CONTENT_TYPE,
+ self::FIELD => $field,
+ self::ENTITY_ID => (string) $block->getId(),
+ ]
+ );
+ $assets = $this->extractAssetsFromContent->execute((string) $block->getData($field));
+
+ foreach ($assets as $asset) {
+ $contentAssetLinks[] = $this->contentAssetLinkFactory->create(
+ [
+ 'assetId' => $asset->getId(),
+ 'contentIdentity' => $contentIdentity
+ ]
+ );
+ }
+ }
+ if (!empty($contentAssetLinks)) {
+ $this->deleteContentAssetLinks->execute($contentAssetLinks);
+ }
+ }
+ }
+}
diff --git a/app/code/Magento/MediaContentCms/Observer/PageDelete.php b/app/code/Magento/MediaContentCms/Observer/PageDelete.php
new file mode 100644
index 0000000000000..96d2bf89873bd
--- /dev/null
+++ b/app/code/Magento/MediaContentCms/Observer/PageDelete.php
@@ -0,0 +1,120 @@
+extractAssetsFromContent = $extractAssetsFromContent;
+ $this->getContent = $getContent;
+ $this->deleteContentAssetLinks = $deleteContentAssetLinks;
+ $this->contentAssetLinkFactory = $contentAssetLinkFactory;
+ $this->contentIdentityFactory = $contentIdentityFactory;
+ $this->fields = $fields;
+ }
+
+ /**
+ * Retrieve the deleted category and remove relation betwen category and asset
+ *
+ * @param Observer $observer
+ * @throws \Exception
+ */
+ public function execute(Observer $observer): void
+ {
+ $page = $observer->getEvent()->getData('object');
+ $contentAssetLinks = [];
+
+ if ($page instanceof CmsPage) {
+ foreach ($this->fields as $field) {
+ $contentIdentity = $this->contentIdentityFactory->create(
+ [
+ self::TYPE => self::CONTENT_TYPE,
+ self::FIELD => $field,
+ self::ENTITY_ID => (string) $page->getId(),
+ ]
+ );
+
+ $assets = $this->extractAssetsFromContent->execute((string) $page->getData($field));
+
+ foreach ($assets as $asset) {
+ $contentAssetLinks[] = $this->contentAssetLinkFactory->create(
+ [
+ 'assetId' => $asset->getId(),
+ 'contentIdentity' => $contentIdentity
+ ]
+ );
+ }
+ }
+ if (!empty($contentAssetLinks)) {
+ $this->deleteContentAssetLinks->execute($contentAssetLinks);
+ }
+ }
+ }
+}
diff --git a/app/code/Magento/MediaContentCms/etc/di.xml b/app/code/Magento/MediaContentCms/etc/di.xml
index f980936465faf..6f196889540af 100644
--- a/app/code/Magento/MediaContentCms/etc/di.xml
+++ b/app/code/Magento/MediaContentCms/etc/di.xml
@@ -20,4 +20,18 @@
+
+
+
+ - content
+
+
+
+
+
+
+ - content
+
+
+
diff --git a/app/code/Magento/MediaContentCms/etc/events.xml b/app/code/Magento/MediaContentCms/etc/events.xml
index 7e9abe3bf19c4..94f963f40be15 100644
--- a/app/code/Magento/MediaContentCms/etc/events.xml
+++ b/app/code/Magento/MediaContentCms/etc/events.xml
@@ -6,8 +6,14 @@
*/
-->
+
+
+
+
+
+
diff --git a/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml b/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
index 55798169cdf75..b42cabde6cd85 100644
--- a/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
+++ b/app/code/Magento/Theme/view/frontend/templates/js/calendar.phtml
@@ -14,7 +14,6 @@