Unverified Commit e4484e10 authored by fubhy's avatar fubhy Committed by GitHub
Browse files

Merge branch '8.x-3.x' into entity-access

parents 34f5a73e 65a6555d
......@@ -73,7 +73,7 @@ class MenuLinks extends FieldPluginBase implements ContainerFactoryPluginInterfa
];
foreach (array_filter($this->menuLinkTree->transform($tree, $manipulators), function (MenuLinkTreeElement $item) {
return $item->link instanceof MenuLinkInterface && $item->link->isEnabled();
return $item->link instanceof MenuLinkInterface && $item->link->isEnabled() && (empty($item->access) || $item->access->isAllowed());
}) as $branch) {
yield $branch;
}
......
......@@ -28,7 +28,7 @@ class MenuLinkLinks extends FieldPluginBase {
if ($value instanceof MenuLinkTreeElement) {
$items = array_filter($value->subtree, function(MenuLinkTreeElement $item) {
if ($item->link instanceof MenuLinkInterface) {
return $item->link->isEnabled();
return ($item->link->isEnabled() && (empty($item->access) || $item->access->isAllowed()));
}
return TRUE;
});
......
......@@ -26,6 +26,7 @@ use GraphQL\Utils\TypeInfo;
use GraphQL\Utils\Utils;
use GraphQL\Validator\Rules\AbstractValidationRule;
use GraphQL\Validator\ValidationContext;
use GraphQL\Validator\Rules\QueryComplexity;
use Symfony\Component\HttpFoundation\RequestStack;
// TODO: Refactor this and clean it up.
......@@ -350,7 +351,12 @@ class QueryProcessor {
$schema = $config->getSchema();
$info = new TypeInfo($schema);
$validation = new ValidationContext($schema, $document, $info);
$visitors = array_values(array_map(function (AbstractValidationRule $rule) use ($validation) {
$visitors = array_values(array_map(function (AbstractValidationRule $rule) use ($validation, $params) {
// Set current variable values for QueryComplexity validation rule case
// @see \GraphQL\GraphQL::promiseToExecute for equivalent
if ($rule instanceof QueryComplexity && !empty($params->variables)) {
$rule->setRawVariableValues($params->variables);
}
return $rule($validation);
}, $rules));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment