diff --git a/Neos.Neos/Classes/Domain/Service/UserService.php b/Neos.Neos/Classes/Domain/Service/UserService.php
index 6edd9b5332f..bab470d18b0 100644
--- a/Neos.Neos/Classes/Domain/Service/UserService.php
+++ b/Neos.Neos/Classes/Domain/Service/UserService.php
@@ -685,7 +685,7 @@ public function deactivateUser(User $user): void
*/
public function currentUserCanPublishToWorkspace(Workspace $workspace): bool
{
- if ($workspace->workspaceName->isLive()) {
+ if ($workspace->isPublicWorkspace()) {
return $this->securityContext->hasRole('Neos.Neos:LivePublisher');
}
@@ -709,7 +709,7 @@ public function currentUserCanPublishToWorkspace(Workspace $workspace): bool
*/
public function currentUserCanReadWorkspace(Workspace $workspace): bool
{
- if ($workspace->workspaceName->isLive() || $workspace->workspaceOwner === null) {
+ if ($workspace->isPublicWorkspace()) {
return true;
}
diff --git a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php
index 6ddcdc300ee..9e24293f650 100644
--- a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php
+++ b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php
@@ -18,6 +18,7 @@
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Fusion\FusionObjects\AbstractFusionObject;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Service\ContentElementEditableService;
/**
@@ -56,18 +57,24 @@ public function evaluate()
{
$content = $this->getValue();
+ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
+ if (!$renderingMode->isEdit) {
+ return $content;
+ }
+
$node = $this->fusionValue('node');
if (!$node instanceof Node) {
return $content;
}
- /** @var string $property */
- $property = $this->fusionValue('property');
-
if (!$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) {
return $content;
}
+ /** @var string $property */
+ $property = $this->fusionValue('property');
+
return $this->contentElementEditableService->wrapContentProperty($node, $property, $content);
}
}
diff --git a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php
index ea8ca0eb6a2..6e2b85fbc85 100644
--- a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php
+++ b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php
@@ -18,6 +18,7 @@
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Fusion\FusionObjects\AbstractFusionObject;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Service\ContentElementWrappingService;
/**
@@ -66,6 +67,12 @@ public function evaluate()
{
$content = $this->getValue();
+ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
+ if (!$renderingMode->isEdit) {
+ return $content;
+ }
+
$node = $this->fusionValue('node');
if (!$node instanceof Node) {
return $content;
diff --git a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php
index 8e30786c1de..151bf487fc4 100644
--- a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php
+++ b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php
@@ -17,6 +17,7 @@
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\Flow\Log\Utility\LogEnvironment;
use Neos\Flow\Mvc\Exception\NoMatchingRouteException;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
@@ -123,16 +124,18 @@ public function evaluate()
), 1382624087);
}
+ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
+ if ($renderingMode->isEdit && $this->fusionValue('forceConversion') !== true) {
+ return $text;
+ }
+
$contentRepository = $this->contentRepositoryRegistry->get(
$node->subgraphIdentity->contentRepositoryId
);
$nodeAddress = NodeAddressFactory::create($contentRepository)->createFromNode($node);
- if (!$nodeAddress->isInLiveWorkspace() && !($this->fusionValue('forceConversion'))) {
- return $text;
- }
-
$unresolvedUris = [];
$absolute = $this->fusionValue('absolute');
diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php
index 200a868cc41..04123026c66 100644
--- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php
+++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php
@@ -21,6 +21,7 @@
use Neos\Flow\Utility\Environment;
use Neos\Fusion\Core\ExceptionHandlers\AbstractRenderingExceptionHandler;
use Neos\Fusion\Core\ExceptionHandlers\ContextDependentHandler;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Service\ContentElementWrappingService;
/**
@@ -72,19 +73,20 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode): s
if (isset($currentContext['node'])) {
/** @var Node $node */
$node = $currentContext['node'];
- $contentRepositoryId = $node->subgraphIdentity->contentRepositoryId;
- $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
- $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId(
- $node->subgraphIdentity->contentStreamId
- );
+
+ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
$applicationContext = $this->environment->getContext();
- if (
- $applicationContext->isProduction()
- && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')
- && !is_null($workspace)
- && !$workspace->workspaceName->isLive()
- ) {
+ if (!$renderingMode->isEdit) {
+ return $output;
+ }
+
+ if (!$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) {
+ return $output;
+ }
+
+ if ($applicationContext->isProduction()) {
$output = '
Failed to render element' . $output . '
';
diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php
index 3928e1dcc25..fc72801df34 100644
--- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php
+++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php
@@ -24,6 +24,7 @@
use Neos\FluidAdaptor\View\StandaloneView;
use Neos\Fusion\Core\ExceptionHandlers\AbstractRenderingExceptionHandler;
use Neos\Fusion\Core\ExceptionHandlers\HtmlMessageHandler;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Service\ContentElementWrappingService;
use Psr\Http\Message\ResponseInterface;
@@ -86,14 +87,11 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode)
}
if (!is_null($documentNode)) {
- $contentRepositoryId = $documentNode->subgraphIdentity->contentRepositoryId;
- $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
- $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId(
- $documentNode->subgraphIdentity->contentStreamId
- );
+ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
if (
- $workspace && !$workspace->workspaceName->isLive()
- && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')
+ $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')
+ && $renderingMode->isEdit
) {
$isBackend = true;
$fluidView->assign(
diff --git a/Neos.Neos/Classes/Service/ContentElementEditableService.php b/Neos.Neos/Classes/Service/ContentElementEditableService.php
index 811dc634a65..16e2159fa9a 100644
--- a/Neos.Neos/Classes/Service/ContentElementEditableService.php
+++ b/Neos.Neos/Classes/Service/ContentElementEditableService.php
@@ -14,14 +14,12 @@
namespace Neos\Neos\Service;
-use Neos\ContentRepository\Core\ContentRepository;
-use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
-use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Fusion\Service\HtmlAugmenter as FusionHtmlAugmenter;
+use Neos\Neos\FrontendRouting\NodeAddressFactory;
/**
* The content element editable service adds the necessary markup around
@@ -56,15 +54,6 @@ public function wrapContentProperty(Node $node, string $property, string $conten
$node->subgraphIdentity->contentRepositoryId
);
- if (
- $this->isContentStreamOfLiveWorkspace(
- $node->subgraphIdentity->contentStreamId,
- $contentRepository
- )
- ) {
- return $content;
- }
-
// TODO: permissions
//if (!$this->nodeAuthorizationService->isGrantedToEditNode($node)) {
// return $content;
@@ -79,13 +68,4 @@ public function wrapContentProperty(Node $node, string $property, string $conten
return $this->htmlAugmenter->addAttributes($content, $attributes, 'span');
}
-
- private function isContentStreamOfLiveWorkspace(
- ContentStreamId $contentStreamId,
- ContentRepository $contentRepository
- ): bool {
- return $contentRepository->getWorkspaceFinder()
- ->findOneByCurrentContentStreamId($contentStreamId)
- ?->workspaceName->isLive() ?: false;
- }
}
diff --git a/Neos.Neos/Classes/Service/ContentElementWrappingService.php b/Neos.Neos/Classes/Service/ContentElementWrappingService.php
index 4851b49da2e..47b224e334c 100644
--- a/Neos.Neos/Classes/Service/ContentElementWrappingService.php
+++ b/Neos.Neos/Classes/Service/ContentElementWrappingService.php
@@ -14,15 +14,13 @@
namespace Neos\Neos\Service;
-use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
-use Neos\Neos\FrontendRouting\NodeAddressFactory;
-use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Flow\Session\SessionInterface;
use Neos\Fusion\Service\HtmlAugmenter as FusionHtmlAugmenter;
+use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\Ui\Domain\Service\UserLocaleService;
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper;
@@ -86,15 +84,6 @@ public function wrapContentObject(
$node->subgraphIdentity->contentRepositoryId
);
- if (
- $this->isContentStreamOfLiveWorkspace(
- $node->subgraphIdentity->contentStreamId,
- $contentRepository
- )
- ) {
- return $content;
- }
-
// TODO: reenable permissions
//if ($this->nodeAuthorizationService->isGrantedToEditNode($node) === false) {
// return $content;
@@ -134,12 +123,10 @@ public function wrapCurrentDocumentMetadata(
string $fusionPath,
array $additionalAttributes = [],
): string {
- $contentRepository = $this->contentRepositoryRegistry->get(
- $node->subgraphIdentity->contentRepositoryId
- );
- if ($this->needsMetadata($node, $contentRepository, true) === false) {
- return $content;
- }
+ // TODO: reenable permissions
+ //if ($this->nodeAuthorizationService->isGrantedToEditNode($node) === false) {
+ // return $content;
+ //}
$attributes = $additionalAttributes;
$attributes['data-__neos-fusion-path'] = $fusionPath;
@@ -168,26 +155,4 @@ protected function addCssClasses(array $attributes, Node $node, array $initialCl
return $attributes;
}
-
- protected function needsMetadata(
- Node $node,
- ContentRepository $contentRepository,
- bool $renderCurrentDocumentMetadata
- ): bool {
- return $this->isContentStreamOfLiveWorkspace(
- $node->subgraphIdentity->contentStreamId,
- $contentRepository
- )
- && ($renderCurrentDocumentMetadata === true
- /* TODO: permissions || $this->nodeAuthorizationService->isGrantedToEditNode($node) === true */);
- }
-
- private function isContentStreamOfLiveWorkspace(
- ContentStreamId $contentStreamId,
- ContentRepository $contentRepository
- ): bool {
- return $contentRepository->getWorkspaceFinder()
- ->findOneByCurrentContentStreamId($contentStreamId)
- ?->workspaceName->isLive() ?: false;
- }
}
diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php
index 5be087be0f3..d6f77451288 100644
--- a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php
+++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php
@@ -20,6 +20,7 @@
use Neos\FluidAdaptor\Core\ViewHelper\AbstractTagBasedViewHelper;
use Neos\FluidAdaptor\Core\ViewHelper\Exception as ViewHelperException;
use Neos\Fusion\ViewHelpers\FusionContextTrait;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Service\ContentElementEditableService;
/**
@@ -114,7 +115,15 @@ public function render(): string
}
$this->tag->setContent($content);
- return $this->contentElementEditableService->wrapContentProperty($node, $propertyName, (string)$this->tag->render());
+ $output = (string)$this->tag->render();
+
+ $renderingMode = $this->getContextVariable('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
+ if (!$renderingMode->isEdit) {
+ return $output;
+ }
+
+ return $this->contentElementEditableService->wrapContentProperty($node, $propertyName, $output);
}
/**
diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php
index d24056239e5..dd19d456035 100644
--- a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php
+++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php
@@ -19,6 +19,7 @@
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
use Neos\FluidAdaptor\Core\ViewHelper\Exception as ViewHelperException;
use Neos\Fusion\FusionObjects\Helpers\FusionAwareViewInterface;
+use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Service\ContentElementWrappingService;
/**
@@ -85,6 +86,13 @@ public function render(): string
1645650713
);
}
+
+ $renderingMode = $fusionObject->getRuntime()->fusionGlobals->get('renderingMode');
+ assert($renderingMode instanceof RenderingMode);
+ if (!$renderingMode->isEdit) {
+ return (string)$this->renderChildren();
+ }
+
$currentContext = $fusionObject->getRuntime()->getCurrentContext();
$node = $this->arguments['node'] ?? $currentContext['node'];
diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php
index ea1d8a9b030..21b8f5ba725 100644
--- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php
+++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php
@@ -12,7 +12,6 @@
*/
use Behat\Gherkin\Node\PyStringNode;
-use Behat\Gherkin\Node\TableNode;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\CRTestSuiteRuntimeVariables;
@@ -24,9 +23,9 @@
use Neos\Fusion\Core\FusionSourceCodeCollection;
use Neos\Fusion\Core\Parser;
use Neos\Fusion\Core\RuntimeFactory;
-use Neos\Neos\Domain\Model\RenderingMode;
-use Neos\Neos\Domain\Service\NodeTypeNameFactory;
use Neos\Fusion\Exception\RuntimeException;
+use Neos\Neos\Domain\Service\NodeTypeNameFactory;
+use Neos\Neos\Domain\Service\RenderingModeService;
use PHPUnit\Framework\Assert;
use Psr\Http\Message\ServerRequestFactoryInterface;
@@ -68,12 +67,12 @@ public function setupFusionContext(): void
}
/**
- * @When I am in Fusion rendering mode:
+ * @When the Fusion renderingMode is :requestUri
*/
- public function iAmInFusionRenderingMode(TableNode $renderingModeData): void
+ public function iAmInFusionRenderingMode(string $renderingModeName): void
{
- $data = $renderingModeData->getHash()[0];
- $this->fusionGlobalContext['renderingMode'] = new RenderingMode($data['name'] ?? 'Testing', strtolower($data['isEdit'] ?? 'false') === 'true', strtolower($data['isPreview'] ?? 'false') === 'true', $data['title'] ?? 'Testing', $data['fusionPath'] ?? 'root', []);
+ $renderingMode = $this->getObject(RenderingModeService::class)->findByName($renderingModeName);
+ $this->fusionGlobalContext['renderingMode'] = $renderingMode;
}
/**
diff --git a/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature b/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature
index 9d9661cc01e..8ed0e7184ca 100644
--- a/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature
+++ b/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature
@@ -55,7 +55,7 @@ Feature: Tests for the "Neos.Neos:ConvertUris" Fusion prototype
"""
And the Fusion context node is "a"
And the Fusion context request URI is "http://localhost"
-
+ And the Fusion renderingMode is "frontend"
Scenario: Default output
When I execute the following Fusion code:
"""fusion
@@ -113,6 +113,22 @@ Feature: Tests for the "Neos.Neos:ConvertUris" Fusion prototype
Some value with node URI: /a1.
"""
+ Scenario: URI preserved in edit mode
+ Given the Fusion renderingMode is "inPlace"
+ When I execute the following Fusion code:
+ """fusion
+ include: resource://Neos.Fusion/Private/Fusion/Root.fusion
+ include: resource://Neos.Neos/Private/Fusion/Root.fusion
+
+ test = Neos.Neos:ConvertUris {
+ value = 'Some value with node URI: node://a1.'
+ }
+ """
+ Then I expect the following Fusion rendering result:
+ """
+ Some value with node URI: node://a1.
+ """
+
Scenario: Anchor tag without node or asset URI
When I execute the following Fusion code:
"""fusion