Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
graphql
Commits
e4484e10
Unverified
Commit
e4484e10
authored
Oct 14, 2019
by
fubhy
Committed by
GitHub
Oct 14, 2019
Browse files
Merge branch '8.x-3.x' into entity-access
parents
34f5a73e
65a6555d
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/graphql_core/src/Plugin/GraphQL/Fields/Menu/MenuLinks.php
View file @
e4484e10
...
...
@@ -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
;
}
...
...
modules/graphql_core/src/Plugin/GraphQL/Fields/MenuLink/MenuLinkLinks.php
View file @
e4484e10
...
...
@@ -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
;
});
...
...
src/GraphQL/Execution/QueryProcessor.php
View file @
e4484e10
...
...
@@ -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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment