Skip to content

Commit

Permalink
TASK: Use singular name for WorkspaceController
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Jun 3, 2024
1 parent 8f19629 commit f667110
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 39 deletions.
20 changes: 0 additions & 20 deletions Neos.Neos/Configuration/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ privilegeTargets:
label: Allowed to discard changes in own workspace
matcher: 'method(Neos\Neos\Service\Controller\WorkspaceController->(discardNode|discardNodes|error)Action()) || method(Neos\Neos\Service\Controller\WorkspaceController->discardAllAction(workspace.name === current.userInformation.personalWorkspaceName))'

#
# Workspace management
#

'Neos.Neos:Backend.Service.Workspaces.Index':
label: Access workspace services
matcher: 'method(Neos\Neos\Controller\Service\WorkspacesController->(index|error|show)Action())'

'Neos.Neos:Backend.Service.Workspaces.ManageOwnWorkspaces':
label: Access services to manage own workspace
matcher: 'method(Neos\Neos\Controller\Service\WorkspacesController->(update|delete)Action(workspace.owner === current.userInformation.backendUser))'

#
# User management and user settings
#
Expand Down Expand Up @@ -209,14 +197,6 @@ roles:
privilegeTarget: 'Neos.Neos:Backend.DiscardOwnWorkspaceContent'
permission: GRANT

-
privilegeTarget: 'Neos.Neos:Backend.Service.Workspaces.Index'
permission: GRANT

-
privilegeTarget: 'Neos.Neos:Backend.Service.Workspaces.ManageOwnWorkspaces'
permission: GRANT

-
privilegeTarget: 'Neos.Neos:Backend.ContentDimensions'
permission: GRANT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;

/**
* The Neos Workspaces module controller
*
* @Flow\Scope("singleton")
* The Neos Workspace module controller
*/
class WorkspacesController extends AbstractModuleController
#[Flow\Scope('singleton')]
class WorkspaceController extends AbstractModuleController
{
use ModuleTranslationTrait;
use NodeTypeWithFallbackProvider;
Expand Down Expand Up @@ -160,9 +159,9 @@ public function showAction(WorkspaceName $workspace): void
$contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())
->contentRepositoryId;
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$workspacesControllerInternals = $this->contentRepositoryRegistry->buildService(
$workspaceControllerInternals = $this->contentRepositoryRegistry->buildService(
$contentRepositoryId,
new WorkspacesControllerInternalsFactory()
new WorkspaceControllerInternalsFactory()
);

$workspaceObj = $contentRepository->getWorkspaceFinder()->findOneByName($workspace);
Expand All @@ -178,7 +177,7 @@ public function showAction(WorkspaceName $workspace): void
// TODO $this->domainUserService->currentUserCanPublishToWorkspace($workspace->getBaseWorkspace()),
'canPublishToBaseWorkspace' => true,
'siteChanges' => $this->computeSiteChanges($workspaceObj, $contentRepository),
'contentDimensions' => $workspacesControllerInternals->getContentDimensionsOrderedByPriority()
'contentDimensions' => $workspaceControllerInternals->getContentDimensionsOrderedByPriority()
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @deprecated really un-nice :D
*/
class WorkspacesControllerInternals implements ContentRepositoryServiceInterface
class WorkspaceControllerInternals implements ContentRepositoryServiceInterface
{
public function __construct(
protected ContentDimensionSourceInterface $contentDimensionSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceFactoryInterface;

/**
* @implements ContentRepositoryServiceFactoryInterface<WorkspacesControllerInternals>
* @implements ContentRepositoryServiceFactoryInterface<WorkspaceControllerInternals>
*/
class WorkspacesControllerInternalsFactory implements ContentRepositoryServiceFactoryInterface
class WorkspaceControllerInternalsFactory implements ContentRepositoryServiceFactoryInterface
{
public function build(
ContentRepositoryServiceFactoryDependencies $serviceFactoryDependencies
): WorkspacesControllerInternals {
return new WorkspacesControllerInternals(
): WorkspaceControllerInternals {
return new WorkspaceControllerInternals(
$serviceFactoryDependencies->contentDimensionSource,
);
}
Expand Down
10 changes: 5 additions & 5 deletions Neos.Workspace.Ui/Configuration/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ privilegeTargets:

'Neos.Neos:Backend.PublishAllToLiveWorkspace':
label: Allowed to publish to the live workspace
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspacesController->publishWorkspaceAction(workspace.baseWorkspace.name === "live"))'
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspaceController->publishWorkspaceAction(workspace.baseWorkspace.name === "live"))'

'Neos.Neos:Backend.CreateWorkspaces':
label: Allowed to create a workspace
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspacesController->(create|new)Action())'
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspaceController->(create|new)Action())'

'Neos.Neos:Backend.Module.Management.Workspaces.ManageOwnWorkspaces':
label: Allowed to manage own workspaces
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspacesController->(publishWorkspace|discardWorkspace|edit|update|delete)Action(workspace.owner === current.userInformation.backendUser))'
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspaceController->(publishWorkspace|discardWorkspace|edit|update|delete)Action(workspace.owner === current.userInformation.backendUser))'

'Neos.Neos:Backend.Module.Management.Workspaces.ManageInternalWorkspaces':
label: Manage internal workspaces
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspacesController->(publishWorkspace|discardWorkspace|edit|update|delete)Action(workspace.owner === null))'
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspaceController->(publishWorkspace|discardWorkspace|edit|update|delete)Action(workspace.owner === null))'

'Neos.Neos:Backend.Module.Management.Workspaces.ManageAllPrivateWorkspaces':
label: Manage all private workspaces
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspacesController->(publishWorkspace|discardWorkspace|edit|update|delete)Action()) && evaluate(this.workspace.owner !== current.userInformation.backendUser, this.workspace.personalWorkspace === false)'
matcher: 'method(Neos\Workspace\Ui\Controller\WorkspaceController->(publishWorkspace|discardWorkspace|edit|update|delete)Action()) && evaluate(this.workspace.owner !== current.userInformation.backendUser, this.workspace.personalWorkspace === false)'

'Neos\Neos\Security\Authorization\Privilege\ModulePrivilege':
'Neos.Neos:Backend.Module.Management.Workspaces':
Expand Down
2 changes: 1 addition & 1 deletion Neos.Workspace.Ui/Configuration/Settings.Neos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Neos:
submodules:
workspaces:
label: 'Neos.Workspace.Ui:Main:workspaces.label'
controller: 'Neos\Workspace\Ui\Controller\WorkspacesController'
controller: 'Neos\Workspace\Ui\Controller\WorkspaceController'
description: 'Neos.Workspace.Ui:Main:workspaces.description'
icon: fas fa-th-large
mainStylesheet: 'Lite'
Expand Down
2 changes: 1 addition & 1 deletion Neos.Workspace.Ui/Configuration/Views.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- requestFilter: 'isPackage("Neos.Workspace.Ui") && isController("Workspaces") && isFormat("html")'
- requestFilter: 'isPackage("Neos.Workspace.Ui") && isController("Workspace") && isFormat("html")'
options:
layoutRootPathPattern: 'resource://Neos.Neos/Private/Layouts'
partialRootPaths:
Expand Down

0 comments on commit f667110

Please sign in to comment.