Skip to content

Commit

Permalink
BUGFIX: Ensure that the live workspace is created WITH public viewing…
Browse files Browse the repository at this point in the history
… permission
  • Loading branch information
mhsdesign committed Dec 6, 2024
1 parent 74cfaaa commit a7d887f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ public function migrateWorkspaceMetadataToWorkspaceService(\Closure $outputFn):
];
$roleAssignments[] = [
'subject_type' => WorkspaceRoleSubjectType::GROUP->value,
'subject' => 'Neos.Neos:Everybody',
'subject' => 'Neos.Flow:Everybody',
'role' => WorkspaceRole::VIEWER->value,
];
} elseif ($isInternalWorkspace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
use Neos\ContentRepository\Export\ProcessingContext;
use Neos\ContentRepository\Export\ProcessorInterface;
use Neos\ContentRepository\Export\Severity;
use Neos\Neos\Domain\Model\WorkspaceDescription;
use Neos\Neos\Domain\Model\WorkspaceRole;
use Neos\Neos\Domain\Model\WorkspaceRoleAssignment;
use Neos\Neos\Domain\Model\WorkspaceTitle;
use Neos\Neos\Domain\Service\WorkspaceService;

/**
Expand All @@ -44,7 +40,6 @@ public function run(ProcessingContext $context): void
$context->dispatch(Severity::NOTICE, 'Workspace already exists, skipping');
return;
}
$this->workspaceService->createRootWorkspace($this->contentRepository->id, WorkspaceName::forLive(), WorkspaceTitle::fromString('Live workspace'), WorkspaceDescription::fromString(''));
$this->workspaceService->assignWorkspaceRole($this->contentRepository->id, WorkspaceName::forLive(), WorkspaceRoleAssignment::createForGroup('Neos.Neos:LivePublisher', WorkspaceRole::COLLABORATOR));
$this->workspaceService->createLiveWorkspaceIfMissing($this->contentRepository->id);
}
}
1 change: 1 addition & 0 deletions Neos.Neos/Classes/Domain/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function createLiveWorkspaceIfMissing(ContentRepositoryId $contentReposit
}
$this->createRootWorkspace($contentRepositoryId, $workspaceName, WorkspaceTitle::fromString('Public live workspace'), WorkspaceDescription::empty());
$this->metadataAndRoleRepository->assignWorkspaceRole($contentRepositoryId, $workspaceName, WorkspaceRoleAssignment::createForGroup('Neos.Neos:LivePublisher', WorkspaceRole::COLLABORATOR));
$this->metadataAndRoleRepository->assignWorkspaceRole($contentRepositoryId, $workspaceName, WorkspaceRoleAssignment::createForGroup('Neos.Flow:Everybody', WorkspaceRole::VIEWER));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ Feature: EditNodePrivilege related features
"""
And using identifier "default", I define a content repository
And I am in content repository "default"
And the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| newContentStreamId | "cs-identifier" |
And the live workspace exists
And I am in workspace "live" and dimension space point {}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ Feature: ReadNodePrivilege related features
"""
And using identifier "default", I define a content repository
And I am in content repository "default"
And the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| newContentStreamId | "cs-identifier" |
And the live workspace exists
And I am in workspace "live" and dimension space point {}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
Expand Down Expand Up @@ -64,7 +61,6 @@ Feature: ReadNodePrivilege related features
| nodeAggregateId | "a" |
| nodeVariantSelectionStrategy | "allSpecializations" |
| tag | "subtree_a" |
And the role VIEWER is assigned to workspace "live" for group "Neos.Flow:Everybody"
When a personal workspace for user "editor" is created
And content repository security is enabled

Expand Down

0 comments on commit a7d887f

Please sign in to comment.