Neos\ContentRepository\Domain\Factory\NodeFactory::filterNodeByContext PHP Method

filterNodeByContext() protected method

Will either return the node or NULL if it is not permitted in current context.
protected filterNodeByContext ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context ) : Neos\ContentRepository\Domain\Model\NodeInterface | null
$node Neos\ContentRepository\Domain\Model\NodeInterface
$context Neos\ContentRepository\Domain\Service\Context
return Neos\ContentRepository\Domain\Model\NodeInterface | null
    protected function filterNodeByContext(NodeInterface $node, Context $context)
    {
        $this->securityContext->withoutAuthorizationChecks(function () use(&$node, $context) {
            if (!$context->isRemovedContentShown() && $node->isRemoved()) {
                $node = null;
                return;
            }
            if (!$context->isInvisibleContentShown() && !$node->isVisible()) {
                $node = null;
                return;
            }
            if (!$context->isInaccessibleContentShown() && !$node->isAccessible()) {
                $node = null;
            }
        });
        return $node;
    }