9
9
use Neos \ContentRepository \Core \SharedModel \Workspace \WorkspaceName ;
10
10
use Neos \ContentRepositoryRegistry \ContentRepositoryRegistry ;
11
11
use Neos \Flow \Persistence \PersistenceManagerInterface ;
12
+ use Neos \Flow \Security \Context ;
12
13
use Neos \Media \Domain \Model \AssetInterface ;
13
14
use Neos \Media \Domain \Model \AssetVariantInterface ;
14
15
use Neos \Neos \AssetUsage \Dto \AssetUsageFilter ;
@@ -24,6 +25,7 @@ public function __construct(
24
25
protected readonly ContentRepositoryRegistry $ contentRepositoryRegistry ,
25
26
protected readonly PersistenceManagerInterface $ persistenceManager ,
26
27
protected readonly ContentCacheFlusher $ contentCacheFlusher ,
28
+ protected readonly Context $ securityContext ,
27
29
) {
28
30
}
29
31
@@ -46,30 +48,32 @@ public function registerAssetChange(AssetInterface $asset): void
46
48
->groupByNodeAggregate ()
47
49
->includeVariantsOfAsset ();
48
50
49
- foreach ($ this ->globalAssetUsageService ->findByFilter ($ filter ) as $ contentRepositoryId => $ usages ) {
50
- $ contentRepository = $ this ->contentRepositoryRegistry ->get (ContentRepositoryId::fromString ($ contentRepositoryId ));
51
+ $ this ->securityContext ->withoutAuthorizationChecks (function () use ($ filter ) {
52
+ foreach ($ this ->globalAssetUsageService ->findByFilter ($ filter ) as $ contentRepositoryId => $ usages ) {
53
+ $ contentRepository = $ this ->contentRepositoryRegistry ->get (ContentRepositoryId::fromString ($ contentRepositoryId ));
51
54
52
- foreach ($ usages as $ usage ) {
53
- $ workspaceNames = $ this ->getWorkspaceNameAndChildWorkspaceNames ($ contentRepository , $ usage ->workspaceName );
55
+ foreach ($ usages as $ usage ) {
56
+ $ workspaceNames = $ this ->getWorkspaceNameAndChildWorkspaceNames ($ contentRepository , $ usage ->workspaceName );
54
57
55
- foreach ($ workspaceNames as $ workspaceName ) {
56
- $ contentGraph = $ contentRepository ->getContentGraph ($ workspaceName );
57
- $ nodeAggregate = $ contentGraph ->findNodeAggregateById ($ usage ->nodeAggregateId );
58
- if ($ nodeAggregate === null ) {
59
- continue ;
60
- }
61
- $ flushNodeAggregateRequest = FlushNodeAggregateRequest::create (
62
- $ contentRepository ->id ,
63
- $ workspaceName ,
64
- $ nodeAggregate ->nodeAggregateId ,
65
- $ nodeAggregate ->nodeTypeName ,
66
- $ contentGraph ->findAncestorNodeAggregateIds ($ nodeAggregate ->nodeAggregateId ),
67
- );
58
+ foreach ($ workspaceNames as $ workspaceName ) {
59
+ $ contentGraph = $ contentRepository ->getContentGraph ($ workspaceName );
60
+ $ nodeAggregate = $ contentGraph ->findNodeAggregateById ($ usage ->nodeAggregateId );
61
+ if ($ nodeAggregate === null ) {
62
+ continue ;
63
+ }
64
+ $ flushNodeAggregateRequest = FlushNodeAggregateRequest::create (
65
+ $ contentRepository ->id ,
66
+ $ workspaceName ,
67
+ $ nodeAggregate ->nodeAggregateId ,
68
+ $ nodeAggregate ->nodeTypeName ,
69
+ $ contentGraph ->findAncestorNodeAggregateIds ($ nodeAggregate ->nodeAggregateId ),
70
+ );
68
71
69
- $ this ->contentCacheFlusher ->flushNodeAggregate ($ flushNodeAggregateRequest , CacheFlushingStrategy::ON_SHUTDOWN );
72
+ $ this ->contentCacheFlusher ->flushNodeAggregate ($ flushNodeAggregateRequest , CacheFlushingStrategy::ON_SHUTDOWN );
73
+ }
70
74
}
71
75
}
72
- }
76
+ });
73
77
}
74
78
75
79
/**
0 commit comments