Skip to content

Commit

Permalink
Re-add basic node policy in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Oct 26, 2024
1 parent f8c9527 commit 18e697e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Neos\Neos\Domain\Service\WorkspacePublishingService;
use Neos\Neos\Domain\Service\WorkspaceService;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService;
use Neos\Neos\Service\UserService;
use Neos\Neos\Ui\Application\ChangeTargetWorkspace;
use Neos\Neos\Ui\Application\DiscardAllChanges;
Expand Down Expand Up @@ -155,6 +156,12 @@ class BackendServiceController extends ActionController
*/
protected $reloadNodesQueryHandler;

/**
* @Flow\Inject
* @var ContentRepositoryAuthorizationService
*/
protected $contentRepositoryAuthorizationService;

/**
* Set the controller context on the feedback collection after the controller
* has been initialized
Expand Down Expand Up @@ -588,12 +595,15 @@ public function getAdditionalNodeMetadataAction(array $nodes): void
return $this->getCurrentDimensionPresetIdentifiersForNode($node);
}, $node->getOtherNodeVariants())));*/
if (!is_null($node)) {
$authenticatedAccount = $this->securityContext->getAccount();
$nodePrivileges = $authenticatedAccount === null
? $this->contentRepositoryAuthorizationService->getNodePermissionsForAnonymousUser($node)
: $this->contentRepositoryAuthorizationService->getNodePermissionsForAccount($node, $authenticatedAccount);
$result[$nodeAddress->toJson()] = [
// todo reimplement nodePolicyService
'policy' => [
'disallowedNodeTypes' => [],
'canRemove' => true,
'canEdit' => true,
'canRemove' => $nodePrivileges->edit,
'canEdit' => $nodePrivileges->edit,
'disallowedProperties' => []
]
//'dimensions' => $this->getCurrentDimensionPresetIdentifiersForNode($node),
Expand Down

0 comments on commit 18e697e

Please sign in to comment.