class WorkspaceCommandController extends CommandController (View source)

The Workspace Command Controller

Properties

protected UserService $userService
protected ContentRepositoryRegistry $contentRepositoryRegistry
protected WorkspacePublishingService $workspacePublishingService
protected WorkspaceService $workspaceService

Methods

void
publishCommand(string $workspace, string $contentRepository = 'default')

Publish changes of a workspace

void
discardCommand(string $workspace, string $contentRepository = 'default')

Discard changes in workspace

void
rebaseCommand(string $workspace, string $contentRepository = 'default', bool $force = false)

Rebase workspace on base workspace

void
createRootCommand(string $name, string $contentRepository = 'default', string|null $title = null, string|null $description = null)

Create a new root workspace for a content repository

void
createPersonalCommand(string $workspace, string $owner, string $baseWorkspace = 'live', string|null $title = null, string|null $description = null, string $contentRepository = 'default')

Create a new personal workspace for the specified user

void
createSharedCommand(string $workspace, string $baseWorkspace = 'live', string|null $title = null, string|null $description = null, string $contentRepository = 'default')

Create a new shared workspace

void
setTitleCommand(string $workspace, string $newTitle, string $contentRepository = 'default')

Set/change the title of a workspace

void
setDescriptionCommand(string $workspace, string $newDescription, string $contentRepository = 'default')

Set/change the description of a workspace

void
assignRoleCommand(string $workspace, string $subject, string $role, string $contentRepository = 'default', string $type = 'group')

Assign a workspace role to the given user/user group

void
unassignRoleCommand(string $workspace, string $subject, string $contentRepository = 'default', string $type = 'group')

Unassign a workspace role from the given user/user group

void
deleteCommand(string $workspace, bool $force = false, string $contentRepository = 'default')

Deletes a workspace

void
rebaseOutdatedCommand(string $contentRepository = 'default', bool $force = false)

Rebase all outdated content streams

void
listCommand(string $contentRepository = 'default')

Display a list of existing workspaces

void
showCommand(string $workspace, string $contentRepository = 'default')

Display details for the specified workspace

Details

void publishCommand(string $workspace, string $contentRepository = 'default')

Publish changes of a workspace

This command publishes all modified, created or deleted nodes in the specified workspace to its base workspace.

Parameters

string $workspace

Name of the workspace containing the changes to publish, for example "user-john"

string $contentRepository

Identifier of the content repository. (Default: 'default')

Return Value

void

void discardCommand(string $workspace, string $contentRepository = 'default')

Discard changes in workspace

This command discards all modified, created or deleted nodes in the specified workspace.

Parameters

string $workspace

Name of the workspace, for example "user-john"

string $contentRepository

Identifier of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void rebaseCommand(string $workspace, string $contentRepository = 'default', bool $force = false)

Rebase workspace on base workspace

This command rebases the given workspace on its base workspace, it may fail if the rebase is not possible.

Parameters

string $workspace

Name of the workspace, for example "user-john"

string $contentRepository

Identifier of the content repository. (Default: 'default')

bool $force

Rebase all events that do not conflict

Return Value

void

Exceptions

StopCommandException

void createRootCommand(string $name, string $contentRepository = 'default', string|null $title = null, string|null $description = null)

Create a new root workspace for a content repository

NOTE: By default, only administrators can access workspaces without role assignments. Use workspace:assignrole to add workspace permissions

Parameters

string $name

Name of the new root

string $contentRepository

Identifier of the content repository. (Default: 'default')

string|null $title

Optional title of the workspace

string|null $description

Optional description of the workspace

Return Value

void

Exceptions

WorkspaceAlreadyExists

void createPersonalCommand(string $workspace, string $owner, string $baseWorkspace = 'live', string|null $title = null, string|null $description = null, string $contentRepository = 'default')

Create a new personal workspace for the specified user

Parameters

string $workspace

Name of the workspace, for example "christmas-campaign"

string $owner

The username (aka account identifier) of a User to own the workspace

string $baseWorkspace

Name of the base workspace. If none is specified, "live" is assumed.

string|null $title

Human friendly title of the workspace, for example "Christmas Campaign"

string|null $description

A description explaining the purpose of the new workspace

string $contentRepository

Identifier of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void createSharedCommand(string $workspace, string $baseWorkspace = 'live', string|null $title = null, string|null $description = null, string $contentRepository = 'default')

Create a new shared workspace

NOTE: By default, only administrators can access workspaces without role assignments. Use workspace:assignrole to add workspace permissions

Parameters

string $workspace

Name of the workspace, for example "christmas-campaign"

string $baseWorkspace

Name of the base workspace. If none is specified, "live" is assumed.

string|null $title

Human friendly title of the workspace, for example "Christmas Campaign"

string|null $description

A description explaining the purpose of the new workspace

string $contentRepository

Identifier of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void setTitleCommand(string $workspace, string $newTitle, string $contentRepository = 'default')

Set/change the title of a workspace

Parameters

string $workspace

Name of the workspace, for example "some-workspace"

string $newTitle

Human friendly title of the workspace, for example "Some workspace"

string $contentRepository

Identifier of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void setDescriptionCommand(string $workspace, string $newDescription, string $contentRepository = 'default')

Set/change the description of a workspace

Parameters

string $workspace

Name of the workspace, for example "some-workspace"

string $newDescription

Human friendly description of the workspace

string $contentRepository

Identifier of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void assignRoleCommand(string $workspace, string $subject, string $role, string $contentRepository = 'default', string $type = 'group')

Assign a workspace role to the given user/user group

Without explicit workspace roles, only administrators can change the corresponding workspace. With this command, a user or group (represented by a Flow role identifier) can be granted one of the two roles:

  • viewer: Can read from the workspace
  • collaborator: Can read from and write to the workspace
  • manager: Can read from and write to the workspace and manage it (i.e. change metadata & role assignments)

Examples:

To grant editors read and write access to a (shared) workspace: ./flow workspace:assignrole some-workspace "Neos.Neos:AbstractEditor" collaborator

To grant a specific user read, write and manage access to a workspace: ./flow workspace:assignrole some-workspace admin manager --type user

{\Neos\Neos\Domain\Model\WorkspaceRole}

Parameters

string $workspace

Name of the workspace, for example "some-workspace"

string $subject

The user/group that should be assigned. By default, this is expected to be a Flow role identifier (e.g. 'Neos.Neos:AbstractEditor') – if $type is 'user', this is the username (aka account identifier) of a Neos user

string $role

Role to assign, either 'viewer', 'collaborator' or 'manager' – a viewer can only read from the workspace, a collaborator can read and write from/to the workspace. A manager can on top change the workspace metadata & roles itself

string $contentRepository

Identifier of the content repository. (Default: 'default')

string $type

Type of role, either 'group' (default) or 'user' – if 'group', $subject is expected to be a Flow role identifier, otherwise the username (aka account identifier) of a Neos user

Return Value

void

Exceptions

StopCommandException

void unassignRoleCommand(string $workspace, string $subject, string $contentRepository = 'default', string $type = 'group')

Unassign a workspace role from the given user/user group

Parameters

string $workspace

Name of the workspace, for example "some-workspace"

string $subject

The user/group that should be unassigned. By default, this is expected to be a Flow role identifier (e.g. 'Neos.Neos:AbstractEditor') – if $type is 'user', this is the username (aka account identifier) of a Neos user

string $contentRepository

Identifier of the content repository. (Default: 'default')

string $type

Type of role, either 'group' (default) or 'user' – if 'group', $subject is expected to be a Flow role identifier, otherwise the username (aka account identifier) of a Neos user

Return Value

void

Exceptions

StopCommandException

See also

assignRoleCommand()

void deleteCommand(string $workspace, bool $force = false, string $contentRepository = 'default')

Deletes a workspace

This command deletes a workspace. If you only want to empty a workspace and not delete the workspace itself, use workspace:discard instead.

Parameters

string $workspace

Name of the workspace, for example "christmas-campaign"

bool $force

Delete the workspace and all of its contents

string $contentRepository

The name of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void rebaseOutdatedCommand(string $contentRepository = 'default', bool $force = false)

Rebase all outdated content streams

Parameters

string $contentRepository

The name of the content repository. (Default: 'default')

bool $force

Return Value

void

void listCommand(string $contentRepository = 'default')

Display a list of existing workspaces

Parameters

string $contentRepository

The name of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException

void showCommand(string $workspace, string $contentRepository = 'default')

Display details for the specified workspace

Parameters

string $workspace

Name of the workspace to show

string $contentRepository

The name of the content repository. (Default: 'default')

Return Value

void

Exceptions

StopCommandException