Neos\ContentRepository\Domain\Model\Workspace::isPrivateWorkspace PHP Method

isPrivateWorkspace() public method

Checks if this workspace is shared only across users with access to internal workspaces, for example "reviewers"
public isPrivateWorkspace ( ) : boolean
return boolean
    public function isPrivateWorkspace()
    {
        return $this->owner !== null && !$this->isPersonalWorkspace();
    }

Usage Example

 /**
  * Checks if the current user may manage the given workspace according to one the roles of the user's accounts
  *
  * In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an
  * ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic.
  *
  * @param Workspace $workspace The workspace
  * @return boolean
  */
 public function currentUserCanManageWorkspace(Workspace $workspace)
 {
     if ($workspace->isPersonalWorkspace()) {
         return false;
     }
     if ($workspace->isInternalWorkspace()) {
         return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageInternalWorkspaces');
     }
     if ($workspace->isPrivateWorkspace() && $workspace->getOwner() === $this->getCurrentUser()) {
         return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageOwnWorkspaces');
     }
     if ($workspace->isPrivateWorkspace() && $workspace->getOwner() !== $this->getCurrentUser()) {
         return $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.Module.Management.Workspaces.ManageAllPrivateWorkspaces');
     }
     return false;
 }