Skip to content

Commit 18e697e

Browse files
committed
Re-add basic node policy in UI
1 parent f8c9527 commit 18e697e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Classes/Controller/BackendServiceController.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use Neos\Neos\Domain\Service\WorkspacePublishingService;
3535
use Neos\Neos\Domain\Service\WorkspaceService;
3636
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
37+
use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService;
3738
use Neos\Neos\Service\UserService;
3839
use Neos\Neos\Ui\Application\ChangeTargetWorkspace;
3940
use Neos\Neos\Ui\Application\DiscardAllChanges;
@@ -155,6 +156,12 @@ class BackendServiceController extends ActionController
155156
*/
156157
protected $reloadNodesQueryHandler;
157158

159+
/**
160+
* @Flow\Inject
161+
* @var ContentRepositoryAuthorizationService
162+
*/
163+
protected $contentRepositoryAuthorizationService;
164+
158165
/**
159166
* Set the controller context on the feedback collection after the controller
160167
* has been initialized
@@ -588,12 +595,15 @@ public function getAdditionalNodeMetadataAction(array $nodes): void
588595
return $this->getCurrentDimensionPresetIdentifiersForNode($node);
589596
}, $node->getOtherNodeVariants())));*/
590597
if (!is_null($node)) {
598+
$authenticatedAccount = $this->securityContext->getAccount();
599+
$nodePrivileges = $authenticatedAccount === null
600+
? $this->contentRepositoryAuthorizationService->getNodePermissionsForAnonymousUser($node)
601+
: $this->contentRepositoryAuthorizationService->getNodePermissionsForAccount($node, $authenticatedAccount);
591602
$result[$nodeAddress->toJson()] = [
592-
// todo reimplement nodePolicyService
593603
'policy' => [
594604
'disallowedNodeTypes' => [],
595-
'canRemove' => true,
596-
'canEdit' => true,
605+
'canRemove' => $nodePrivileges->edit,
606+
'canEdit' => $nodePrivileges->edit,
597607
'disallowedProperties' => []
598608
]
599609
//'dimensions' => $this->getCurrentDimensionPresetIdentifiersForNode($node),

0 commit comments

Comments
 (0)