Skip to content

Commit c55bcce

Browse files
committed
#29880: GraphQL categories and categoryList do not consider Category Permissions configuration
PR review points
1 parent ef20485 commit c55bcce

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

app/code/Magento/CatalogGraphQl/Model/Category/CategoryFilter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ public function __construct(
8383
*
8484
* @param array $criteria
8585
* @param StoreInterface $store
86+
* @param array $attributeNames
8687
* @param ContextInterface $context
8788
* @return int[]
8889
* @throws InputException
8990
*/
90-
public function getResult(array $criteria, StoreInterface $store, ContextInterface $context)
91+
public function getResult(array $criteria, StoreInterface $store, array $attributeNames, ContextInterface $context)
9192
{
9293
$searchCriteria = $this->searchCriteria->buildCriteria($criteria, $store);
9394
$collection = $this->categoryCollectionFactory->create();
9495
$this->extensionAttributesJoinProcessor->process($collection);
95-
$this->collectionProcessor->process($collection, $searchCriteria, $context);
96+
$this->collectionProcessor->process($collection, $searchCriteria, $attributeNames, $context);
9697

9798
/** @var CategorySearchResultsInterface $searchResult */
9899
$categories = $this->categorySearchResultsFactory->create();

app/code/Magento/CatalogGraphQl/Model/Resolver/Categories/DataProvider/Category/CollectionProcessor/CatalogProcessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ public function __construct(
3737
*
3838
* @param Collection $collection
3939
* @param SearchCriteriaInterface $searchCriteria
40+
* @param array $attributeNames
4041
* @param ContextInterface|null $context
4142
* @return Collection
43+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4244
*/
4345
public function process(
4446
Collection $collection,
4547
SearchCriteriaInterface $searchCriteria,
48+
array $attributeNames,
4649
ContextInterface $context = null
4750
): Collection {
4851
$this->collectionProcessor->process($searchCriteria, $collection);

app/code/Magento/CatalogGraphQl/Model/Resolver/Categories/DataProvider/Category/CollectionProcessorInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ interface CollectionProcessorInterface
2121
*
2222
* @param Collection $collection
2323
* @param SearchCriteriaInterface $searchCriteria
24+
* @param array $attributeNames
2425
* @param ContextInterface|null $context
2526
* @return Collection
2627
*/
2728
public function process(
2829
Collection $collection,
2930
SearchCriteriaInterface $searchCriteria,
31+
array $attributeNames,
3032
ContextInterface $context = null
3133
): Collection;
3234
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Categories/DataProvider/Category/CompositeCollectionProcessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ public function __construct(array $collectionProcessors = [])
3636
*
3737
* @param Collection $collection
3838
* @param SearchCriteriaInterface $searchCriteria
39+
* @param array $attributeNames
3940
* @param ContextInterface|null $context
4041
* @return Collection
4142
*/
4243
public function process(
4344
Collection $collection,
4445
SearchCriteriaInterface $searchCriteria,
46+
array $attributeNames,
4547
ContextInterface $context = null
4648
): Collection {
4749
foreach ($this->collectionProcessors as $collectionProcessor) {
48-
$collection = $collectionProcessor->process($collection, $searchCriteria, $context);
50+
$collection = $collectionProcessor->process($collection, $searchCriteria, $attributeNames, $context);
4951
}
5052

5153
return $collection;

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoriesQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
7070
}
7171

7272
try {
73-
$filterResult = $this->categoryFilter->getResult($args, $store, $context);
73+
$filterResult = $this->categoryFilter->getResult($args, $store, [], $context);
7474
} catch (InputException $e) {
7575
throw new GraphQlInputException(__($e->getMessage()));
7676
}

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoryList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
6565
$args['filters']['ids'] = ['eq' => $store->getRootCategoryId()];
6666
}
6767
try {
68-
$filterResults = $this->categoryFilter->getResult($args, $store, $context);
68+
$filterResults = $this->categoryFilter->getResult($args, $store, [], $context);
6969
$rootCategoryIds = $filterResults['category_ids'];
7070
} catch (InputException $e) {
7171
throw new GraphQlInputException(__($e->getMessage()));

0 commit comments

Comments
 (0)