diff --git a/Neos.ContentRepository.Core/Classes/Feature/Security/StaticAuthProvider.php b/Neos.ContentRepository.Core/Classes/Feature/Security/StaticAuthProvider.php index 2aa741f599..bd3500fe6a 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/Security/StaticAuthProvider.php +++ b/Neos.ContentRepository.Core/Classes/Feature/Security/StaticAuthProvider.php @@ -7,8 +7,6 @@ use Neos\ContentRepository\Core\CommandHandler\CommandInterface; use Neos\ContentRepository\Core\Feature\Security\Dto\Privilege; use Neos\ContentRepository\Core\Feature\Security\Dto\UserId; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTags; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; @@ -31,7 +29,7 @@ public function getAuthenticatedUserId(): UserId public function getVisibilityConstraints(WorkspaceName $workspaceName): VisibilityConstraints { - return VisibilityConstraints::excludeSubtreeTags(SubtreeTags::create(SubtreeTag::disabled())); + return VisibilityConstraints::createEmpty(); } public function canReadNodesFromWorkspace(WorkspaceName $workspaceName): Privilege diff --git a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Dto/SubtreeTag.php b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Dto/SubtreeTag.php index 7e2493e669..fde5f9e118 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Dto/SubtreeTag.php +++ b/Neos.ContentRepository.Core/Classes/Feature/SubtreeTagging/Dto/SubtreeTag.php @@ -47,6 +47,13 @@ public static function fromString(string $value): self return self::instance($value); } + /** + * Legacy, only for Neos.Neos context!, for standalone use please use {@see self::fromString()} + * + * Please use {@see \Neos\Neos\Domain\Service\NeosSubtreeTag::disabled()} instead. + * + * @deprecated with Neos 9 beta 19 + */ public static function disabled(): self { return self::instance('disabled'); diff --git a/Neos.ContentRepository.LegacyNodeMigration/Classes/Processors/EventExportProcessor.php b/Neos.ContentRepository.LegacyNodeMigration/Classes/Processors/EventExportProcessor.php index 6d547c385b..928fb54d7f 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Classes/Processors/EventExportProcessor.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Classes/Processors/EventExportProcessor.php @@ -27,7 +27,6 @@ use Neos\ContentRepository\Core\Feature\NodeVariation\Event\NodePeerVariantWasCreated; use Neos\ContentRepository\Core\Feature\NodeVariation\Event\NodeSpecializationVariantWasCreated; use Neos\ContentRepository\Core\Feature\RootNodeCreation\Event\RootNodeAggregateWithNodeWasCreated; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasTagged; use Neos\ContentRepository\Core\Infrastructure\Property\PropertyConverter; use Neos\ContentRepository\Core\NodeType\NodeType; @@ -53,6 +52,7 @@ use Neos\ContentRepository\LegacyNodeMigration\RootNodeTypeMapping; use Neos\Flow\Persistence\Doctrine\DataTypes\JsonArrayType; use Neos\Flow\Property\PropertyMapper; +use Neos\Neos\Domain\Service\NeosSubtreeTag; use Neos\Neos\Domain\Service\NodeTypeNameFactory; use Webmozart\Assert\Assert; @@ -274,7 +274,7 @@ public function processNodeDataWithoutFallbackToEmptyDimension(ProcessingContext } // nodes are hidden via SubtreeWasTagged event if ($this->isNodeHidden($nodeDataRow)) { - $this->exportEvent(new SubtreeWasTagged($this->workspaceName, $this->contentStreamId, $nodeAggregateId, $this->interDimensionalVariationGraph->getSpecializationSet($originDimensionSpacePoint->toDimensionSpacePoint(), true, $this->visitedNodes->alreadyVisitedOriginDimensionSpacePoints($nodeAggregateId)->toDimensionSpacePointSet()), SubtreeTag::disabled())); + $this->exportEvent(new SubtreeWasTagged($this->workspaceName, $this->contentStreamId, $nodeAggregateId, $this->interDimensionalVariationGraph->getSpecializationSet($originDimensionSpacePoint->toDimensionSpacePoint(), true, $this->visitedNodes->alreadyVisitedOriginDimensionSpacePoints($nodeAggregateId)->toDimensionSpacePointSet()), NeosSubtreeTag::disabled())); } if (!$serializedPropertyValuesAndReferences->references->isEmpty()) { diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ContextOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ContextOperation.php index 9c7909aad0..47fed7c0c1 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ContextOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ContextOperation.php @@ -15,7 +15,6 @@ */ use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; @@ -24,6 +23,7 @@ use Neos\Eel\FlowQuery\FlowQueryException; use Neos\Eel\FlowQuery\Operations\AbstractOperation; use Neos\Flow\Annotations as Flow; +use Neos\Neos\Domain\Service\NeosSubtreeTag; /** * "context" operation working on ContentRepository nodes. Modifies the ContentRepository Context of each @@ -116,8 +116,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) $newDimensions ?? $contextNode->dimensionSpacePoint, VisibilityConstraints::excludeSubtreeTags( match ($newInvisibleContentShown) { - true => $contextNode->visibilityConstraints->excludedSubtreeTags->without(SubtreeTag::disabled()), - false => $contextNode->visibilityConstraints->excludedSubtreeTags->with(SubtreeTag::disabled()), + true => $contextNode->visibilityConstraints->excludedSubtreeTags->without(NeosSubtreeTag::disabled()), + false => $contextNode->visibilityConstraints->excludedSubtreeTags->with(NeosSubtreeTag::disabled()), null => $contextNode->visibilityConstraints->excludedSubtreeTags } ) diff --git a/Neos.Neos/Classes/Domain/Service/NeosSubtreeTag.php b/Neos.Neos/Classes/Domain/Service/NeosSubtreeTag.php index 70b7eb6b6c..51a78b2438 100644 --- a/Neos.Neos/Classes/Domain/Service/NeosSubtreeTag.php +++ b/Neos.Neos/Classes/Domain/Service/NeosSubtreeTag.php @@ -4,6 +4,7 @@ namespace Neos\Neos\Domain\Service; +use Neos\ContentRepository\Core\Feature\SubtreeTagging\Command\UntagSubtree; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; /** @@ -13,20 +14,43 @@ * * By default, Neos provides two kinds of subtree tags: * - * - `disabled` {@see SubtreeTag::disabled()} which is used when disabling a node + * - `disabled` {@see NeosSubtreeTag::disabled()} which is used when disabling a node * - `removed` {@see NeosSubtreeTag::removed()} which is used when soft removing a node * * The visibility constraints {@see NeosVisibilityConstraints} define which tagged nodes are queried. * * @api */ -final class NeosSubtreeTag +final readonly class NeosSubtreeTag { private function __construct() { // no instances } + /** + * Content repository subtree tag which is used to denote that a node is disabled + * + * By default, disabled nodes never show up in the fronend rendering of a document. + * + * Disabling a node / its subtree is done via {@see TagSubtree}. + * In reverse enabling a node {@see UntagSubtree} is to be used. + * + * $contentRepository->handle(TagSubtree::create( + * $node->workspaceName, + * $node->aggregateId, + * $node->dimensionSpacePoint, + * NodeVariantSelectionStrategy::STRATEGY_ALL_SPECIALIZATIONS, + * NeosSubtreeTag::disabled() + * )); + * + * @api + */ + public static function disabled(): SubtreeTag + { + return SubtreeTag::fromString('disabled'); + } + /** * Content repository subtree tag which is used to denote that a node is soft removed * diff --git a/Neos.Neos/Classes/Domain/Service/NeosVisibilityConstraints.php b/Neos.Neos/Classes/Domain/Service/NeosVisibilityConstraints.php index f6b6c3808f..fe9875c966 100644 --- a/Neos.Neos/Classes/Domain/Service/NeosVisibilityConstraints.php +++ b/Neos.Neos/Classes/Domain/Service/NeosVisibilityConstraints.php @@ -4,8 +4,6 @@ namespace Neos\Neos\Domain\Service; -use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\DisableNodeAggregate; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTags; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; @@ -17,7 +15,7 @@ * * By default, Neos provides two kinds of subtree tags: * - * - `disabled` {@see SubtreeTag::disabled()} which is used when disabling a node via {@see DisableNodeAggregate} + * - `disabled` {@see NeosSubtreeTag::disabled()} which is used when disabling a node * - `removed` {@see NeosSubtreeTag::removed()} which is used when soft removing a node * * To control which nodes will be queried via the {@see ContentSubgraphInterface}, the visibility constraints can be used. @@ -50,7 +48,7 @@ private function __construct() public static function excludeDisabled(): VisibilityConstraints { return VisibilityConstraints::excludeSubtreeTags(SubtreeTags::create( - SubtreeTag::disabled() + NeosSubtreeTag::disabled() )); } diff --git a/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php b/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php index 18ea54c94d..7f7b0379cb 100644 --- a/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php +++ b/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php @@ -14,7 +14,6 @@ namespace Neos\Neos\Fusion\Helper; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\NodeType\NodeType; use Neos\ContentRepository\Core\Projection\ContentGraph\AbsoluteNodePath; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; @@ -28,6 +27,7 @@ use Neos\Flow\Annotations as Flow; use Neos\Neos\Domain\Exception; use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; +use Neos\Neos\Domain\Service\NeosSubtreeTag; use Neos\Neos\Domain\Service\NodeTypeNameFactory; use Neos\Neos\Presentation\VisualNodePath; @@ -103,7 +103,7 @@ public function isOfType(Node $node, string $nodeType): bool public function isDisabled(Node $node): bool { - return $node->tags->contain(SubtreeTag::disabled()); + return $node->tags->contain(NeosSubtreeTag::disabled()); } /** diff --git a/Neos.Neos/Classes/Service/LinkingService.php b/Neos.Neos/Classes/Service/LinkingService.php index 7ffdffd7d9..ca46f300c6 100644 --- a/Neos.Neos/Classes/Service/LinkingService.php +++ b/Neos.Neos/Classes/Service/LinkingService.php @@ -15,7 +15,6 @@ namespace Neos\Neos\Service; use GuzzleHttp\Psr7\Uri; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; @@ -28,6 +27,7 @@ use Neos\Media\Domain\Model\AssetInterface; use Neos\Neos\Domain\Model\Site; use Neos\Neos\Domain\Repository\SiteRepository; +use Neos\Neos\Domain\Service\NeosSubtreeTag; use Neos\Neos\Exception as NeosException; use Neos\Neos\FrontendRouting\NodeUriBuilder; use Neos\Neos\Fusion\Helper\LinkHelper; @@ -290,7 +290,7 @@ public function createNodeUri( $mainRequest = $controllerContext->getRequest()->getMainRequest(); $uriBuilder = clone $controllerContext->getUriBuilder(); $uriBuilder->setRequest($mainRequest); - $createLiveUri = $workspace && $nodeAddress->workspaceName->isLive() && !$resolvedNode->tags->contain(SubtreeTag::disabled()); + $createLiveUri = $workspace && $nodeAddress->workspaceName->isLive() && !$resolvedNode->tags->contain(NeosSubtreeTag::disabled()); if ($addQueryString === true) { // legacy feature see https://github.com/neos/neos-development-collection/issues/5076 diff --git a/Neos.TimeableNodeVisibility/Classes/Service/TimeableNodeVisibilityService.php b/Neos.TimeableNodeVisibility/Classes/Service/TimeableNodeVisibilityService.php index ac2e03ad39..e53dae9ce3 100644 --- a/Neos.TimeableNodeVisibility/Classes/Service/TimeableNodeVisibilityService.php +++ b/Neos.TimeableNodeVisibility/Classes/Service/TimeableNodeVisibilityService.php @@ -7,7 +7,6 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\DisableNodeAggregate; use Neos\ContentRepository\Core\Feature\NodeDisabling\Command\EnableNodeAggregate; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\NodeType\NodeTypeNames; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter; @@ -21,6 +20,7 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; +use Neos\Neos\Domain\Service\NeosSubtreeTag; use Neos\Neos\Domain\Service\NeosVisibilityConstraints; use Neos\TimeableNodeVisibility\Domain\ChangedVisibilities; use Neos\TimeableNodeVisibility\Domain\ChangedVisibility; @@ -48,7 +48,7 @@ public function handleExceededNodeDates(ContentRepositoryId $contentRepositoryId /** @var Node $node */ foreach ($nodes as $node) { - $nodeIsDisabled = $node->tags->contain(SubtreeTag::disabled()); + $nodeIsDisabled = $node->tags->contain(NeosSubtreeTag::disabled()); if ($this->needsEnabling($node, $now) && $nodeIsDisabled) { $contentRepository->handle( EnableNodeAggregate::create( diff --git a/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php b/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php index 3f23da5d49..b836c33f83 100644 --- a/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php +++ b/Neos.TimeableNodeVisibility/Tests/Behavior/Bootstrap/FeatureContext.php @@ -7,14 +7,14 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceFactoryInterface; use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceInterface; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\CRTestSuiteTrait; -use Neos\ContentRepository\TestSuite\Fakes\FakeNodeTypeManagerFactory; use Neos\ContentRepository\TestSuite\Fakes\FakeContentDimensionSourceFactory; +use Neos\ContentRepository\TestSuite\Fakes\FakeNodeTypeManagerFactory; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; +use Neos\Neos\Domain\Service\NeosSubtreeTag; use Neos\TimeableNodeVisibility\Service\TimeableNodeVisibilityService; use PHPUnit\Framework\Assert; @@ -59,7 +59,7 @@ public function iExpectThisNodeToBeEnabled(): void ); $currentNode = $subgraph->findNodeById($this->currentNode->aggregateId); Assert::assertNotNull($currentNode, sprintf('Failed to find node with id "%s" in workspace %s and dimension %s', $this->currentNode->aggregateId->value, $subgraph->getWorkspaceName()->value, $subgraph->getDimensionSpacePoint()->toJson())); - Assert::assertFalse($currentNode->tags->contain(SubtreeTag::disabled()), sprintf('Node "%s" was expected to be enabled, but it is not', $this->currentNode->aggregateId->value)); + Assert::assertFalse($currentNode->tags->contain(NeosSubtreeTag::disabled()), sprintf('Node "%s" was expected to be enabled, but it is not', $this->currentNode->aggregateId->value)); } /** @@ -74,7 +74,7 @@ public function iExpectThisNodeToBeDisabled(): void ); $currentNode = $subgraph->findNodeById($this->currentNode->aggregateId); Assert::assertNotNull($currentNode, sprintf('Failed to find node with id "%s" in workspace %s and dimension %s', $this->currentNode->aggregateId->value, $subgraph->getWorkspaceName()->value, $subgraph->getDimensionSpacePoint()->toJson())); - Assert::assertTrue($currentNode->tags->contain(SubtreeTag::disabled()), sprintf('Node "%s" was expected to be disabled, but it is not', $this->currentNode->aggregateId->value)); + Assert::assertTrue($currentNode->tags->contain(NeosSubtreeTag::disabled()), sprintf('Node "%s" was expected to be disabled, but it is not', $this->currentNode->aggregateId->value)); } protected function getContentRepositoryService( diff --git a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php index 3ba6a0abfa..5189a9f0db 100644 --- a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php +++ b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php @@ -17,8 +17,8 @@ use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Dimension\ContentDimensionId; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; -use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag; use Neos\ContentRepository\Core\Feature\WorkspaceCreation\Exception\WorkspaceAlreadyExists; +use Neos\ContentRepository\Core\Feature\WorkspaceRebase\ConflictingEvent; use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Dto\RebaseErrorHandlingStrategy; use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Exception\WorkspaceRebaseFailed; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindAncestorNodesFilter; @@ -55,6 +55,7 @@ use Neos\Neos\Domain\Model\WorkspaceTitle; use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Neos\Neos\Domain\Repository\SiteRepository; +use Neos\Neos\Domain\Service\NeosSubtreeTag; use Neos\Neos\Domain\Service\NodeTypeNameFactory; use Neos\Neos\Domain\Service\UserService; use Neos\Neos\Domain\Service\WorkspacePublishingService; @@ -64,7 +65,6 @@ use Neos\Neos\PendingChangesProjection\ChangeFinder; use Neos\Neos\PendingChangesProjection\Changes; use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService; -use Neos\ContentRepository\Core\Feature\WorkspaceRebase\ConflictingEvent; use Neos\Neos\Utility\NodeTypeWithFallbackProvider; use Neos\Workspace\Ui\ViewModel\ChangeItem; use Neos\Workspace\Ui\ViewModel\ContentChangeItem; @@ -915,7 +915,7 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos isRemoved: $change->deleted, isNew: $change->created, isMoved: $change->moved, - isHidden: $documentNode->tags->contain(SubtreeTag::disabled()), + isHidden: $documentNode->tags->contain(NeosSubtreeTag::disabled()), ); } @@ -939,7 +939,7 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos } $siteChanges[$siteNodeName]['documents'][$documentPath]['changes'][$node->dimensionSpacePoint->hash][$relativePath] = new ChangeItem( serializedNodeAddress: $nodeAddress->toJson(), - hidden: $node->tags->contain(SubtreeTag::disabled()), + hidden: $node->tags->contain(NeosSubtreeTag::disabled()), isRemoved: $change->deleted, isNew: $change->created, isMoved: $change->moved,