Skip to content

Commit

Permalink
Merge pull request #5146 from neos/feature/4726-extract-workspace-met…
Browse files Browse the repository at this point in the history
…adata-and-user-assignment-to-neos

!!! FEATURE: Extract workspace metadata and user-assignment to Neos
  • Loading branch information
mhsdesign authored Oct 9, 2024
2 parents 6889251 + 5540c83 commit 9b00e8e
Show file tree
Hide file tree
Showing 63 changed files with 2,991 additions and 1,732 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* Change workspace owner of a workspace, identified by $workspaceName.
* Setting $newWorkspaceOwner to null, removes the current workspace owner.
*
* @api commands are the write-API of the ContentRepository
* @deprecated with 9.0.0-beta14 owners/collaborators should be assigned to workspaces outside the Content Repository core
* @internal
*/
final readonly class ChangeWorkspaceOwner implements CommandInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
/**
* Change the title or description of a workspace
*
* @api commands are the write-API of the ContentRepository
* @deprecated with 9.0.0-beta14 metadata should be assigned to workspaces outside the Content Repository core
* @internal
*/
final readonly class RenameWorkspace implements CommandInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,73 @@
*
* @api
*/
class Workspace
final readonly class Workspace
{
/**
* This prefix determines if a given workspace (name) is a user workspace.
* @deprecated with 9.0.0-beta14 metadata should be assigned to workspaces outside the Content Repository core
*/
public const PERSONAL_WORKSPACE_PREFIX = 'user-';

/**
* @var WorkspaceName Workspace identifier, unique within one Content Repository instance
*/
public WorkspaceName $workspaceName;

/**
* @var WorkspaceName|null Workspace identifier of the base workspace (i.e. the target when publishing changes) – if null this instance is considered a root (aka public) workspace
*/
public ?WorkspaceName $baseWorkspaceName;

/**
* @deprecated with 9.0.0-beta14 metadata should be assigned to workspaces outside the Content Repository core
*/
public WorkspaceTitle $workspaceTitle;

/**
* @deprecated with 9.0.0-beta14 metadata should be assigned to workspaces outside the Content Repository core
*/
public WorkspaceDescription $workspaceDescription;

/**
* The Content Stream this workspace currently points to – usually it is set to a new, empty content stream after publishing/rebasing the workspace
*/
public ContentStreamId $currentContentStreamId;

/**
* The current status of this workspace
*/
public WorkspaceStatus $status;

/**
* @deprecated with 9.0.0-beta14 owners/collaborators should be assigned to workspaces outside the Content Repository core
*/
public string|null $workspaceOwner;

/**
* @internal
*/
public function __construct(
public readonly WorkspaceName $workspaceName,
public readonly ?WorkspaceName $baseWorkspaceName,
public readonly WorkspaceTitle $workspaceTitle,
public readonly WorkspaceDescription $workspaceDescription,
public readonly ContentStreamId $currentContentStreamId,
public readonly WorkspaceStatus $status,
public readonly ?string $workspaceOwner
WorkspaceName $workspaceName,
?WorkspaceName $baseWorkspaceName,
WorkspaceTitle $workspaceTitle,
WorkspaceDescription $workspaceDescription,
ContentStreamId $currentContentStreamId,
WorkspaceStatus $status,
?string $workspaceOwner
) {
$this->workspaceName = $workspaceName;
$this->baseWorkspaceName = $baseWorkspaceName;
$this->workspaceTitle = $workspaceTitle;
$this->workspaceDescription = $workspaceDescription;
$this->currentContentStreamId = $currentContentStreamId;
$this->status = $status;
$this->workspaceOwner = $workspaceOwner;
}


/**
* Checks if this workspace is a user's personal workspace
* @api
* @deprecated with 9.0.0-beta14 owners/collaborators should be assigned to workspaces outside the Content Repository core
*/
public function isPersonalWorkspace(): bool
{
Expand All @@ -59,7 +101,7 @@ public function isPersonalWorkspace(): bool
* Checks if this workspace is shared only across users with access to internal workspaces, for example "reviewers"
*
* @return bool
* @api
* @deprecated with 9.0.0-beta14 owners/collaborators should be assigned to workspaces outside the Content Repository core
*/
public function isPrivateWorkspace(): bool
{
Expand All @@ -70,6 +112,7 @@ public function isPrivateWorkspace(): bool
* Checks if this workspace is shared across all editors
*
* @return boolean
* @deprecated with 9.0.0-beta14 owners/collaborators should be assigned to workspaces outside the Content Repository core
*/
public function isInternalWorkspace(): bool
{
Expand All @@ -80,6 +123,7 @@ public function isInternalWorkspace(): bool
* Checks if this workspace is public to everyone, even without authentication
*
* @return boolean
* @deprecated with 9.0.0-beta14 owners/collaborators should be assigned to workspaces outside the Content Repository core
*/
public function isPublicWorkspace(): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
/**
* Description for a workspace
*
* @api
* @deprecated with 9.0.0-beta14 metadata should be assigned to workspaces outside the Content Repository core
* @internal
*/
final readonly class WorkspaceDescription implements \JsonSerializable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
/**
* Human-Readable title of a workspace
*
* @api
* @deprecated with 9.0.0-beta14 metadata should be assigned to workspaces outside the Content Repository core
* @internal
*/
final readonly class WorkspaceTitle implements \JsonSerializable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function theCommandCreateRootWorkspaceIsExecutedWithPayload(TableNode $pa
$command = CreateRootWorkspace::create(
WorkspaceName::fromString($commandArguments['workspaceName']),
new WorkspaceTitle($commandArguments['workspaceTitle'] ?? ucfirst($commandArguments['workspaceName'])),
new WorkspaceDescription($commandArguments['workspaceDescription'] ?? 'The workspace "' . $commandArguments['workspaceName'] . '"'),
new WorkspaceDescription($commandArguments['workspaceDescription'] ?? ('The workspace "' . $commandArguments['workspaceName'] . '"')),
ContentStreamId::fromString($commandArguments['newContentStreamId'])
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class FakeUserIdProvider implements UserIdProviderInterface
{
private static ?UserId $userId = null;
public static ?UserId $userId = null;

public static function setUserId(UserId $userId): void
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace Neos\ContentRepositoryRegistry\Command;
Expand All @@ -8,15 +9,31 @@
use Neos\ContentRepositoryRegistry\Service\EventMigrationServiceFactory;
use Neos\Flow\Cli\CommandController;

final class MigrateEventsCommandController extends CommandController
class MigrateEventsCommandController extends CommandController
{
public function __construct(
private readonly ContentRepositoryRegistry $contentRepositoryRegistry,
private readonly EventMigrationServiceFactory $eventMigrationServiceFactory,
private readonly EventMigrationServiceFactory $eventMigrationServiceFactory
) {
parent::__construct();
}

/**
* Migrates initial metadata & roles from the CR core workspaces to the corresponding Neos database tables
*
* Needed to extract these information to Neos.Neos: https://github.com/neos/neos-development-collection/issues/4726
*
* Included in September 2024 - before final Neos 9.0 release
*
* @param string $contentRepository Identifier of the Content Repository to migrate
*/
public function migrateWorkspaceMetadataToWorkspaceServiceCommand(string $contentRepository = 'default'): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
$eventMigrationService = $this->contentRepositoryRegistry->buildService($contentRepositoryId, $this->eventMigrationServiceFactory);
$eventMigrationService->migrateWorkspaceMetadataToWorkspaceService($this->outputLine(...));
}

/**
* Migrates "propertyValues":{"tagName":{"value":null,"type":"string"}} to "propertiesToUnset":["tagName"]
*
Expand Down
Loading

0 comments on commit 9b00e8e

Please sign in to comment.