-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from magento-commerce/1.1.44-release
1.1.44 release
- Loading branch information
Showing
20 changed files
with
2,451 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.