Skip to content

Commit aaefc08

Browse files
authored
Merge pull request #423 from gradinarufelix/bugfix/backport-419-security-context-for-node-lookup
BUGFIX: Find nodes in CR without security checks to allow nodes of other workspaces
2 parents 476d3ee + 21e9331 commit aaefc08

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Classes/Indexer/NodeIndexer.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use Neos\ContentRepository\Search\Indexer\AbstractNodeIndexer;
3737
use Neos\ContentRepository\Search\Indexer\BulkNodeIndexerInterface;
3838
use Neos\Flow\Annotations as Flow;
39+
use Neos\Flow\Security\Context as SecurityContext;
3940
use Neos\Utility\Exception\FilesException;
4041
use Neos\Flow\Log\Utility\LogEnvironment;
4142
use Psr\Log\LoggerInterface;
@@ -145,6 +146,12 @@ class NodeIndexer extends AbstractNodeIndexer implements BulkNodeIndexerInterfac
145146
*/
146147
protected $errorStorage;
147148

149+
/**
150+
* @Flow\Inject
151+
* @var SecurityContext
152+
*/
153+
protected $securityContext;
154+
148155
/**
149156
* The current Elasticsearch bulk request, in the format required by https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
150157
*/
@@ -270,7 +277,12 @@ public function indexNode(NodeInterface $node, $targetWorkspace = null): void
270277
};
271278

272279
$handleNode = function (NodeInterface $node, Context $context) use ($targetWorkspace, $indexer) {
273-
$nodeFromContext = $context->getNodeByIdentifier($node->getIdentifier());
280+
$nodeFromContext = null;
281+
$this->securityContext->withoutAuthorizationChecks(
282+
function () use ($context, $node, &$nodeFromContext) {
283+
$nodeFromContext = $context->getNodeByIdentifier($node->getIdentifier());
284+
}
285+
);
274286
if ($nodeFromContext instanceof NodeInterface) {
275287
$this->searchClient->withDimensions(static function () use ($indexer, $nodeFromContext, $targetWorkspace) {
276288
$indexer($nodeFromContext, $targetWorkspace);

0 commit comments

Comments
 (0)