/** * Shows a list of existing workspaces * * @return string */ public function indexAction() { $user = $this->userService->getCurrentUser(); $workspacesArray = []; /** @var Workspace $workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { // FIXME: This check should be implemented through a specialized Workspace Privilege or something similar if ($workspace->getOwner() !== null && $workspace->getOwner() !== $user) { continue; } $workspaceArray = ['name' => $workspace->getName(), 'title' => $workspace->getTitle(), 'description' => $workspace->getDescription(), 'baseWorkspace' => $workspace->getBaseWorkspace()]; if ($user !== null) { $workspaceArray['readonly'] = !$this->userService->currentUserCanPublishToWorkspace($workspace); } $workspacesArray[] = $workspaceArray; } $this->view->assign('workspaces', $workspacesArray); }
/** * @param Workspace $workspace * @return void */ public function showAction(Workspace $workspace) { $this->view->assignMultiple(['selectedWorkspace' => $workspace, 'selectedWorkspaceLabel' => $workspace->getTitle() ?: $workspace->getName(), 'baseWorkspaceName' => $workspace->getBaseWorkspace()->getName(), 'baseWorkspaceLabel' => $workspace->getBaseWorkspace()->getTitle() ?: $workspace->getBaseWorkspace()->getName(), 'canPublishToBaseWorkspace' => $this->userService->currentUserCanPublishToWorkspace($workspace->getBaseWorkspace()), 'siteChanges' => $this->computeSiteChanges($workspace)]); }