diff options
author | Olivier Paroz <github@oparoz.com> | 2015-06-29 18:18:43 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-06-29 18:18:43 +0300 |
commit | 8a8baf42ec3205991b23b2a720977faf57603936 (patch) | |
tree | ad9550239749bcec684c0c1452d2ac6d157b3551 /environment | |
parent | 01d2f29a4c13b516abb8450d85392c96e34196dd (diff) |
Re-enable features on public spaces
Fixes #195
Diffstat (limited to 'environment')
-rw-r--r-- | environment/environment.php | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/environment/environment.php b/environment/environment.php index 35504273..633a9e07 100644 --- a/environment/environment.php +++ b/environment/environment.php @@ -191,15 +191,6 @@ class Environment { } /** - * Returns the shared node - * - * @return File|Folder - */ - public function getSharedNode() { - return $this->getResourceFromId($this->sharedNodeId); - } - - /** * Returns the resource identified by the given ID * * @param int $resourceId @@ -218,6 +209,36 @@ class Environment { } /** + * Returns the shared node + * + * @return File|Folder + */ + public function getSharedNode() { + return $this->getResourceFromId($this->sharedNodeId); + } + + /** + * Returns the virtual root where the user lands after logging in or when following a link + * + * @return Folder + * + * @throws EnvironmentException + */ + public function getVirtualRootFolder() { + $rootFolder = $this->userFolder; + if (!empty($this->sharedNodeId)) { + $node = $this->getResourceFromId($this->sharedNodeId); + if ($node->getType() === 'dir') { + $rootFolder = $node; + } else { + $this->logAndThrowNotFound($node->getPath() . ' is not a folder'); + } + } + + return $rootFolder; + } + + /** * Returns the userId of the currently logged-in user or the sharer * * @return string |