Returns TRUE if the currently authenticated user is allowed to edit the given $node, otherwise FALSE
public isGrantedToEditNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node ) : boolean | ||
$node | Neos\ContentRepository\Domain\Model\NodeInterface | |
return | boolean |
/** * Wrap the $content identified by $node with the needed markup for the backend. * * @param NodeInterface $node * @param string $property * @param string $content * @return string */ public function wrapContentProperty(NodeInterface $node, $property, $content) { /** @var $contentContext ContentContext */ $contentContext = $node->getContext(); if ($contentContext->getWorkspaceName() === 'live' || !$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) { return $content; } if (!$this->nodeAuthorizationService->isGrantedToEditNode($node)) { return $content; } $attributes = array(); $attributes['class'] = 'neos-inline-editable'; $attributes['property'] = 'typo3:' . $property; $attributes['data-neos-node-type'] = $node->getNodeType()->getName(); return $this->htmlAugmenter->addAttributes($content, $attributes, 'span'); }
/** * @Given /^I should get (TRUE|FALSE) when asking the node authorization service if editing the "([^"]*)" property is granted$/ */ public function iShouldGetTrueWhenAskingTheNodeAuthorizationServiceIfEditingThePropertyIsGranted($expectedResult, $propertyName) { if ($this->isolated === true) { $this->callStepInSubProcess(__METHOD__, sprintf(' %s %s %s %s', 'string', escapeshellarg(trim($expectedResult)), 'string', escapeshellarg($propertyName))); } else { if ($expectedResult === 'TRUE') { if ($this->nodeAuthorizationService->isGrantedToEditNode($this->currentNodes[0], $propertyName) !== true) { Assert::fail('The node authorization service did not return TRUE!'); } } else { if ($this->nodeAuthorizationService->isGrantedToEditNode($this->currentNodes[0], $propertyName) !== false) { Assert::fail('The node authorization service did not return FALSE!'); } } } }
/** * @param NodeInterface $node * @param boolean $renderCurrentDocumentMetadata * @return boolean */ protected function needsMetadata(NodeInterface $node, $renderCurrentDocumentMetadata) { /** @var $contentContext ContentContext */ $contentContext = $node->getContext(); return $contentContext->isInBackend() === true && ($renderCurrentDocumentMetadata === true || $this->nodeAuthorizationService->isGrantedToEditNode($node) === true); }