Skip to content

Commit

Permalink
BUGFIX: Adjust to removed Neos WorkspaceName
Browse files Browse the repository at this point in the history
See #4534
Related: #4533
  • Loading branch information
bwaidelich committed Sep 19, 2023
1 parent 7a6c923 commit 1f7d2b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 31 deletions.
14 changes: 6 additions & 8 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,23 @@
*/

use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Flow\ResourceManagement\ResourceManager;
use Neos\Flow\Security\Context;
use Neos\Flow\Session\SessionInterface;
use Neos\Fusion\View\FusionView;
use Neos\Neos\Controller\Backend\MenuHelper;
use Neos\Neos\Domain\Repository\DomainRepository;
use Neos\Neos\Domain\Repository\SiteRepository;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\Service\BackendRedirectionService;
use Neos\Neos\Service\UserService;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Fusion\View\FusionView;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Neos\Ui\Domain\Service\StyleAndJavascriptInclusionService;
use Neos\Neos\Ui\Service\NodeClipboard;

Expand Down Expand Up @@ -148,8 +147,7 @@ public function indexAction(string $node = null)

$currentAccount = $this->securityContext->getAccount();
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName(
NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName()
WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier())
);
if (is_null($workspace)) {
$this->redirectToUri($this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos'));
Expand Down
27 changes: 11 additions & 16 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@
* source code.
*/

use Neos\ContentRepository\Core\Feature\WorkspaceModification\Command\ChangeBaseWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Exception\WorkspaceIsNotEmptyException;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\DiscardIndividualNodesFromWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\PublishIndividualNodesFromWorkspace;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdsToPublishOrDiscard;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateCurrentlyDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\ActionResponse;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Mvc\View\JsonView;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\Security\Context;
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\FrontendRouting\NodeAddress;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
Expand All @@ -40,6 +42,8 @@
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Error;
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Info;
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Success;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\Redirect;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateWorkspaceInfo;
use Neos\Neos\Ui\Domain\Model\FeedbackCollection;
use Neos\Neos\Ui\Domain\Service\NodeTreeBuilder;
Expand All @@ -50,12 +54,6 @@
use Neos\Neos\Ui\Service\PublishingService;
use Neos\Neos\Ui\TypeConverter\ChangeCollectionConverter;
use Neos\Neos\Utility\NodeUriPathSegmentGenerator;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Command\ChangeBaseWorkspace;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\Redirect;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Exception\WorkspaceIsNotEmptyException;

class BackendServiceController extends ActionController
{
Expand Down Expand Up @@ -195,8 +193,7 @@ public function publishAllAction(): void
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);

$currentAccount = $this->securityContext->getAccount();
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName();
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
$this->publishingService->publishWorkspace($contentRepository, $workspaceName);

$success = new Success();
Expand All @@ -222,8 +219,7 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa

try {
$currentAccount = $this->securityContext->getAccount();
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName();
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());

$nodeIdentifiersToPublish = [];
foreach ($nodeContextPaths as $contextPath) {
Expand Down Expand Up @@ -282,8 +278,7 @@ public function discardAction(array $nodeContextPaths): void

try {
$currentAccount = $this->securityContext->getAccount();
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
->toContentRepositoryWorkspaceName();
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());

$nodeIdentifiersToDiscard = [];
foreach ($nodeContextPaths as $contextPath) {
Expand Down Expand Up @@ -334,9 +329,9 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d
$nodeAddress = $nodeAddressFactory->createFromUriString($documentNode);

$currentAccount = $this->securityContext->getAccount();
$userWorkspaceName = NeosWorkspaceName::fromAccountIdentifier(
$userWorkspaceName = WorkspaceNameBuilder::fromAccountIdentifier(
$currentAccount->getAccountIdentifier()
)->toContentRepositoryWorkspaceName();
);

$command = ChangeBaseWorkspace::create($userWorkspaceName, WorkspaceName::fromString($targetWorkspaceName));
try {
Expand Down
10 changes: 3 additions & 7 deletions Classes/Fusion/Helper/WorkspaceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
* source code.
*/

use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Eel\ProtectedContextAwareInterface;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
use Neos\Flow\Security\Context;
use Neos\Neos\Domain\Service\UserService as DomainUserService;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\Ui\ContentRepository\Service\WorkspaceService;

/**
Expand Down Expand Up @@ -63,9 +61,7 @@ public function getPersonalWorkspace(ContentRepositoryId $contentRepositoryId):
{
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$currentAccount = $this->securityContext->getAccount();
$personalWorkspaceName = NeosWorkspaceName::fromAccountIdentifier(
$currentAccount->getAccountIdentifier()
)->toContentRepositoryWorkspaceName();
$personalWorkspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
$personalWorkspace = $contentRepository->getWorkspaceFinder()->findOneByName($personalWorkspaceName);

return !is_null($personalWorkspace)
Expand Down

0 comments on commit 1f7d2b2

Please sign in to comment.