/** * Returns the name of the currently logged in user's personal workspace (even if that might not exist at that time). * If no user is logged in this method returns null. * * @return string * @api */ public function getPersonalWorkspaceName() { $currentUser = $this->userDomainService->getCurrentUser(); if (!$currentUser instanceof User) { return null; } $username = $this->userDomainService->getUsername($currentUser); return $username === null ? null : UserUtility::getPersonalWorkspaceNameForUsername($username); }
/** * Returns the name of the currently logged in user's personal workspace (even if that might not exist at that time). * If no user is logged in this method returns null. * * @return string * @api */ public function getPersonalWorkspaceName() { $currentUser = $this->userDomainService->getCurrentUser(); if (!$currentUser instanceof User) { return null; } $username = $this->userDomainService->getUsername($currentUser); return 'user-' . preg_replace('/[^a-z0-9]/i', '', $username); }