Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!! FEATURE: Extract workspace metadata and user-assignment to Neos #5146

Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5f1e296
FEATURE: Extract workspace metadata and user-assignment to Neos
bwaidelich Jun 17, 2024
113e0b6
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Jun 28, 2024
773de1a
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Jul 4, 2024
8975a5f
wip
bwaidelich Jul 8, 2024
9c74b65
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Aug 2, 2024
4326424
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Aug 7, 2024
54df32a
Mini tweaks
bwaidelich Aug 9, 2024
dccfb50
wip
bwaidelich Aug 16, 2024
723f26c
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Sep 6, 2024
0af1fa2
WIP: Fix WorkspaceService as discussed with basti & christian
mhsdesign Sep 9, 2024
80e3aef
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Sep 10, 2024
e705924
Fix WorkspaceService::createRootWorkspace()
bwaidelich Sep 10, 2024
11aa9b3
Use `WorkspaceService` in workspace::createroot CLI command
bwaidelich Sep 10, 2024
bdfb954
Stabilize unique workspace name creation
bwaidelich Sep 10, 2024
cf95ee2
Merge remote-tracking branch 'origin/9.0' into feature/4726-extract-w…
mhsdesign Sep 17, 2024
0f20b89
Provide CLI to synchronize workspace metadata and roles
bwaidelich Sep 19, 2024
a467296
Stabilize and document WorkspaceService
bwaidelich Sep 23, 2024
616852e
Fix workspace role handling
bwaidelich Sep 25, 2024
5d448c8
Improve "pending changes" projection and read model
bwaidelich Sep 25, 2024
fd1a616
Cosmetic tweaks to satisfy linter
bwaidelich Sep 25, 2024
b70fb60
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Sep 25, 2024
fe34b60
Move owner assignment from role to metadata, fix migration
bwaidelich Sep 27, 2024
96c427b
Remove UI specific publishable node info array from `Changes` VO
bwaidelich Sep 27, 2024
c3f51e2
Make `WorkspaceNameBuilder` obsolete and remove it
bwaidelich Sep 27, 2024
732b81a
Remove workspace related left-overs from `UserService`
bwaidelich Sep 27, 2024
8f87ddf
Make `Utility\User` class obsolete and remove it
bwaidelich Sep 30, 2024
cbe3ba5
Rework migration to work on the database table directly
bwaidelich Sep 30, 2024
22d8d3a
TASK: Make migration more stable by not relying on the projection but…
mhsdesign Sep 30, 2024
1e1849d
Optimize `migrateWorkspaceMetadataToWorkspaceService` migration
bwaidelich Oct 1, 2024
a27fb02
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Oct 1, 2024
b84ae90
TASK: Adjust deprecations
mhsdesign Oct 1, 2024
702d749
TASK: Deprecate `UserInterface`
mhsdesign Oct 1, 2024
3410ca7
TASK: Add comment for `$Persistence_Object_Identifier` "hack"
mhsdesign Oct 1, 2024
686ff3d
TASK: Improve exceptions
mhsdesign Oct 1, 2024
5c3e817
TASK: Make migration independent of workspaceService
mhsdesign Oct 1, 2024
721b413
TASK: Add missing `@internal` annotations
mhsdesign Oct 1, 2024
e64ff93
TASK: Remove obsolete todos
mhsdesign Oct 1, 2024
88e344d
Merge branch '9.0' into feature/4726-extract-workspace-metadata-and-u…
bwaidelich Oct 7, 2024
25e9957
Rename `WorkspaceSubjectType` to `WorkspaceRoleSubjectType`
bwaidelich Oct 8, 2024
2dde2cf
Make `WorkspaceService` more explicit
bwaidelich Oct 8, 2024
1e3e2f7
Workspace UI: Workspace role preset
bwaidelich Oct 8, 2024
904c716
`WorkspacePermissions` doc comments
bwaidelich Oct 8, 2024
8bafb5a
Add more doc comments
bwaidelich Oct 8, 2024
f68300a
wip
bwaidelich Oct 8, 2024
7d6a819
Fix and improve Behat tests for WorkspaceService
bwaidelich Oct 9, 2024
3b3d718
Remove `workspaceName` from `WorkspaceMetadata`
bwaidelich Oct 9, 2024
e284cf0
Fix typo in private method
bwaidelich Oct 9, 2024
cc85cbf
TASK: Improve documentation
mhsdesign Oct 9, 2024
02d9c97
Merge branch 'feature/4726-extract-workspace-metadata-and-user-assign…
bwaidelich Oct 9, 2024
5fc33d5
Allow to determine Workspace role assignments
bwaidelich Oct 9, 2024
31119ae
Allow to determine Workspace role assignments
bwaidelich Oct 9, 2024
51c7201
stabilize WorkspaceMetadata constructor
bwaidelich Oct 9, 2024
aa1655d
Fix `WorkspaceService::getWorkspacePermissionsForUser()`
bwaidelich Oct 9, 2024
732acc8
Merge branch 'feature/4726-extract-workspace-metadata-and-user-assign…
bwaidelich Oct 9, 2024
5540c83
TASK: Use `WorkspaceRoleAssignment` in `assignWorkspaceRole` signatur
mhsdesign Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-';
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved

/**
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved
* @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
Loading