Skip to content

Commit

Permalink
Merge pull request #149 from magento-commerce/1.1.44-release
Browse files Browse the repository at this point in the history
1.1.44 release
  • Loading branch information
apoltoratskyi authored Jan 19, 2024
2 parents 857bb8d + 71fe19d commit 07928a1
Show file tree
Hide file tree
Showing 20 changed files with 2,451 additions and 229 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/quality-patches",
"description": "Provides quality patches for AdobeCommerce & Magento OpenSource",
"type": "magento2-component",
"version": "1.1.43",
"version": "1.1.44",
"license": "proprietary",
"repositories": {
"repo": {
Expand Down
2 changes: 1 addition & 1 deletion patches-info.json

Large diffs are not rendered by default.

229 changes: 229 additions & 0 deletions patches/commerce/ACSD-54283_2.4.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
diff --git a/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php
new file mode 100644
index 000000000000..8c9a8c78d63c
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * ADOBE CONFIDENTIAL
+ *
+ * Copyright 2023 Adobe
+ * All Rights Reserved.
+ *
+ * NOTICE: All information contained herein is, and remains
+ * the property of Adobe and its suppliers, if any. The intellectual
+ * and technical concepts contained herein are proprietary to Adobe
+ * and its suppliers and are protected by all applicable intellectual
+ * property laws, including trade secret and copyright laws.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Adobe.
+ */
+declare(strict_types=1);
+
+namespace Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog;
+
+use Magento\CatalogPermissions\App\Config;
+use Magento\CatalogPermissions\Model\Permission\Index;
+use Magento\Customer\Model\Group;
+use Magento\Framework\DB\Select;
+use Magento\Sitemap\Model\ResourceModel\Catalog\CategorySelectBuilder;
+use Magento\Store\Api\Data\StoreInterface;
+
+class CategoryPlugin
+{
+ /**
+ * @var Config
+ */
+ private $config;
+
+ /**
+ * @var Index
+ */
+ private $permissionIndex;
+
+ /**
+ * Constructor.
+ *
+ * @param Config $config
+ * @param Index $permissionIndex
+ */
+ public function __construct(Config $config, Index $permissionIndex) {
+ $this->config = $config;
+ $this->permissionIndex = $permissionIndex;
+ }
+
+ /**
+ * Allow only products from public shared catalog assigned to allowed categories
+ *
+ * @param CategorySelectBuilder $subject
+ * @param Select $select
+ * @param string $mainTableName
+ * @param string $idField
+ * @param StoreInterface $store
+ * @param string $path
+ * @return Select
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterExecute(
+ CategorySelectBuilder $subject,
+ Select $select,
+ string $mainTableName,
+ string $idField,
+ StoreInterface $store,
+ string $path
+ ): Select {
+ if (!$this->config->isEnabled($store->getId())) {
+ return $select;
+ }
+
+ $restrictedCategoryIds = $this->permissionIndex->getRestrictedCategoryIds(
+ Group::NOT_LOGGED_IN_ID,
+ $store->getWebsiteId()
+ );
+ if (count($restrictedCategoryIds)) {
+ $select->where('e.entity_id NOT IN (?)', $restrictedCategoryIds);
+ }
+
+ return $select;
+ }
+}
diff --git a/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php
new file mode 100644
index 000000000000..a9bd546e4a9d
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ * ADOBE CONFIDENTIAL
+ *
+ * Copyright 2023 Adobe
+ * All Rights Reserved.
+ *
+ * NOTICE: All information contained herein is, and remains
+ * the property of Adobe and its suppliers, if any. The intellectual
+ * and technical concepts contained herein are proprietary to Adobe
+ * and its suppliers and are protected by all applicable intellectual
+ * property laws, including trade secret and copyright laws.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Adobe.
+ */
+declare(strict_types=1);
+
+namespace Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog;
+
+use Magento\CatalogPermissions\App\Config;
+use Magento\CatalogPermissions\Model\Permission;
+use Magento\CatalogPermissions\Model\Permission\Index;
+use Magento\Customer\Model\Group;
+use Magento\Framework\DB\Select;
+use Magento\Sitemap\Model\ResourceModel\Catalog\ProductSelectBuilder;
+use Magento\Store\Api\Data\StoreInterface;
+
+class ProductPlugin
+{
+ /**
+ * @var Config
+ */
+ private $config;
+
+ /**
+ * @var Index
+ */
+ private $permissionIndex;
+
+ /**
+ * Constructor.
+ *
+ * @param Config $config
+ * @param Index $permissionIndex
+ */
+ public function __construct(Config $config, Index $permissionIndex) {
+ $this->config = $config;
+ $this->permissionIndex = $permissionIndex;
+ }
+
+ /**
+ * Allow only products from public shared catalog assigned to allowed categories
+ *
+ * @param ProductSelectBuilder $subject
+ * @param Select $select
+ * @param string $mainTableName
+ * @param string $idField
+ * @param string $linkField
+ * @param StoreInterface $store
+ * @return Select
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterExecute(
+ ProductSelectBuilder $subject,
+ Select $select,
+ string $mainTableName,
+ string $idField,
+ string $linkField,
+ StoreInterface $store
+ ): Select {
+ if (!$this->config->isEnabled($store->getId())) {
+ return $select;
+ }
+
+ $restrictedCategoryIds = $this->permissionIndex->getRestrictedCategoryIds(
+ Group::NOT_LOGGED_IN_ID,
+ $store->getWebsiteId()
+ );
+ if (count($restrictedCategoryIds)) {
+ $select->joinLeft(
+ ['cp' => $select->getConnection()->getTableName('catalog_category_product')],
+ 'cp.product_id = e.entity_id',
+ []
+ )->where(
+ 'cp.category_id NOT IN (?)',
+ $restrictedCategoryIds
+ );
+ $select->joinLeft(
+ ['perm' => $select->getConnection()->getTableName('magento_catalogpermissions_index_product')],
+ 'perm.product_id = e.entity_id',
+ []
+ )->where(
+ '((perm.grant_catalog_category_view != ' . Permission::PERMISSION_DENY . '
+ AND perm.customer_group_id = ' . Group::NOT_LOGGED_IN_ID . '
+ AND perm.store_id in (?)) OR perm.grant_catalog_category_view IS NULL)',
+ [$store->getId()]
+ );
+ }
+
+ return $select;
+ }
+}
diff --git a/vendor/magento/module-catalog-permissions/etc/di.xml b/vendor/magento/module-catalog-permissions/etc/di.xml
index 242c242eec23..f3ed70b02854 100644
--- a/vendor/magento/module-catalog-permissions/etc/di.xml
+++ b/vendor/magento/module-catalog-permissions/etc/di.xml
@@ -74,4 +74,12 @@
<type name="Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection">
<plugin name="can_show_price_in_layered_navigation_plugin" type="Magento\CatalogPermissions\Plugin\CatalogSearch\Model\ResourceModel\Fulltext\Collection" />
</type>
+ <type name="Magento\Sitemap\Model\ResourceModel\Catalog\ProductSelectBuilder">
+ <plugin name="generate_sitemap_with_allowed_products_permissions"
+ type="Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog\ProductPlugin" />
+ </type>
+ <type name="Magento\Sitemap\Model\ResourceModel\Catalog\CategorySelectBuilder">
+ <plugin name="generate_sitemap_with_allowed_categories_permissions"
+ type="Magento\CatalogPermissions\Plugin\Sitemap\Model\ResourceModel\Catalog\CategoryPlugin" />
+ </type>
</config>
diff --git a/vendor/magento/module-catalog-permissions/etc/module.xml b/vendor/magento/module-catalog-permissions/etc/module.xml
index 438774a51137..adf4fbd42aed 100644
--- a/vendor/magento/module-catalog-permissions/etc/module.xml
+++ b/vendor/magento/module-catalog-permissions/etc/module.xml
@@ -13,6 +13,7 @@
<module name="Magento_CatalogSearch"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
+ <module name="Magento_Sitemap" />
<module name="Magento_WebsiteRestriction"/>
<module name="Magento_Ui"/>
</sequence>
58 changes: 58 additions & 0 deletions patches/commerce/ACSD-55231_1.3.3-p3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/vendor/magento/module-shared-catalog/Plugin/AdvancedCheckout/Model/HideProductsAbsentInSharedCatalogPlugin.php b/vendor/magento/module-shared-catalog/Plugin/AdvancedCheckout/Model/HideProductsAbsentInSharedCatalogPlugin.php
index 00f8752122d6..a14bc3387e9a 100644
--- a/vendor/magento/module-shared-catalog/Plugin/AdvancedCheckout/Model/HideProductsAbsentInSharedCatalogPlugin.php
+++ b/vendor/magento/module-shared-catalog/Plugin/AdvancedCheckout/Model/HideProductsAbsentInSharedCatalogPlugin.php
@@ -15,9 +15,12 @@
use Magento\SharedCatalog\Model\SharedCatalogResolver;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
+use Magento\Customer\Model\Session;

/**
* Plugin for the AdvancedCheckout Cart model to change item status on not found.
+ *
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class HideProductsAbsentInSharedCatalogPlugin
{
@@ -41,22 +44,30 @@ class HideProductsAbsentInSharedCatalogPlugin
*/
private $sharedCatalogProductCollectionFactory;

+ /**
+ * @var \Magento\Customer\Model\Session
+ */
+ private $customerSession;
+
/**
* @param StatusInfoInterface $config
* @param StoreManagerInterface $storeManager
* @param SharedCatalogResolver $sharedCatalogResolver
* @param CollectionFactory $sharedCatalogProductCollectionFactory
+ * @param Session $customerSession
*/
public function __construct(
StatusInfoInterface $config,
StoreManagerInterface $storeManager,
SharedCatalogResolver $sharedCatalogResolver,
- CollectionFactory $sharedCatalogProductCollectionFactory
+ CollectionFactory $sharedCatalogProductCollectionFactory,
+ Session $customerSession
) {
$this->config = $config;
$this->storeManager = $storeManager;
$this->sharedCatalogResolver = $sharedCatalogResolver;
$this->sharedCatalogProductCollectionFactory = $sharedCatalogProductCollectionFactory;
+ $this->customerSession = $customerSession;
}

/**
@@ -71,7 +82,7 @@ public function afterCheckItems(Cart $subject, array $items): array
{
$website = $this->storeManager->getWebsite()->getId();
if ($this->config->isActive(ScopeInterface::SCOPE_WEBSITE, $website)) {
- $customer = $subject->getActualQuote()->getCustomer();
+ $customer = $this->customerSession->getCustomer();
$groupId = $customer && $customer->getId()
? (int) $customer->getGroupId()
: GroupManagement::NOT_LOGGED_IN_ID;
Loading

0 comments on commit 07928a1

Please sign in to comment.