Skip to content

Commit 65a6555

Browse files
Dan Lemonfubhy
authored andcommitted
Fix: add check for menu link access (#900)
1 parent 270ca1e commit 65a6555

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/graphql_core/src/Plugin/GraphQL/Fields/Menu/MenuLinks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function resolveValues($value, array $args, ResolveContext $context, Reso
7373
];
7474

7575
foreach (array_filter($this->menuLinkTree->transform($tree, $manipulators), function (MenuLinkTreeElement $item) {
76-
return $item->link instanceof MenuLinkInterface && $item->link->isEnabled();
76+
return $item->link instanceof MenuLinkInterface && $item->link->isEnabled() && (empty($item->access) || $item->access->isAllowed());
7777
}) as $branch) {
7878
yield $branch;
7979
}

modules/graphql_core/src/Plugin/GraphQL/Fields/MenuLink/MenuLinkLinks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function resolveValues($value, array $args, ResolveContext $context, Reso
2828
if ($value instanceof MenuLinkTreeElement) {
2929
$items = array_filter($value->subtree, function(MenuLinkTreeElement $item) {
3030
if ($item->link instanceof MenuLinkInterface) {
31-
return $item->link->isEnabled();
31+
return ($item->link->isEnabled() && (empty($item->access) || $item->access->isAllowed()));
3232
}
3333
return TRUE;
3434
});

0 commit comments

Comments
 (0)