Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-06-29 18:18:43 +0300
committerOlivier Paroz <github@oparoz.com>2015-06-29 18:18:43 +0300
commit8a8baf42ec3205991b23b2a720977faf57603936 (patch)
treead9550239749bcec684c0c1452d2ac6d157b3551
parent01d2f29a4c13b516abb8450d85392c96e34196dd (diff)
Re-enable features on public spaces
Fixes #195
-rw-r--r--environment/environment.php39
-rw-r--r--service/configparser.php4
-rw-r--r--service/configservice.php2
-rw-r--r--service/filesservice.php2
4 files changed, 34 insertions, 13 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
diff --git a/service/configparser.php b/service/configparser.php
index 6305d029..e240ef4b 100644
--- a/service/configparser.php
+++ b/service/configparser.php
@@ -73,9 +73,9 @@ class ConfigParser {
* @throws ServiceException
*/
private function parseConfig($folder, $configName) {
- /** @var File $configFile */
- $configFile = $folder->get($configName);
try {
+ /** @var File $configFile */
+ $configFile = $folder->get($configName);
$rawConfig = $configFile->getContent();
$saneConfig = $this->bomFixer($rawConfig);
$parsedConfig = Yaml::parse($saneConfig);
diff --git a/service/configservice.php b/service/configservice.php
index b450fd11..5b8e003b 100644
--- a/service/configservice.php
+++ b/service/configservice.php
@@ -71,7 +71,7 @@ class ConfigService extends FilesService {
public function getFeaturesList() {
$featuresList = [];
/** @var Folder $rootFolder */
- $rootFolder = $this->environment->getNode('');
+ $rootFolder = $this->environment->getVirtualRootFolder();
if ($rootFolder && $rootFolder->nodeExists($this->configName)) {
try {
$featuresList =
diff --git a/service/filesservice.php b/service/filesservice.php
index 5527fc94..8efd3dbc 100644
--- a/service/filesservice.php
+++ b/service/filesservice.php
@@ -176,7 +176,7 @@ class FilesService extends Service {
*/
protected function isRootFolder($folder, $level) {
$isRootFolder = false;
- $rootFolder = $this->environment->getNode('');
+ $rootFolder = $this->environment->getVirtualRootFolder();
if ($folder->getPath() === $rootFolder->getPath()) {
$isRootFolder = true;
}