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..af1ccf507d7a
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/CategoryPlugin.php
@@ -0,0 +1,75 @@
+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..f1df4e384eeb
--- /dev/null
+++ b/vendor/magento/module-catalog-permissions/Plugin/Sitemap/Model/ResourceModel/Catalog/ProductPlugin.php
@@ -0,0 +1,92 @@
+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 f1a96cd977fa..390b89b33806 100644
--- a/vendor/magento/module-catalog-permissions/etc/di.xml
+++ b/vendor/magento/module-catalog-permissions/etc/di.xml
@@ -99,4 +99,12 @@
+
+
+
+
+
+