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

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-04-07 14:11:25 +0300
committerGitHub <noreply@github.com>2020-04-07 14:11:25 +0300
commit9691def7bc669825a721e4e6aa42324693f8aae0 (patch)
tree18b0a8a2bc919085d0d2c76e65ac06d8d21a178e /lib
parent5a4f8ede047c59ca50f5c598f1d4506267258439 (diff)
parent858e412f62865298aefb2a22c0abffcb3cee2da3 (diff)
Merge pull request #748 from nextcloud/bugfix/noid/rich-workspace-dav-available
Only return 404 for workspace property if it is not avilable
Diffstat (limited to 'lib')
-rw-r--r--lib/DAV/WorkspacePlugin.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php
index a566838a8..c39b5b364 100644
--- a/lib/DAV/WorkspacePlugin.php
+++ b/lib/DAV/WorkspacePlugin.php
@@ -28,8 +28,10 @@ use OC\Files\Node\File;
use OC\Files\Node\Folder;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Files\FilesHome;
+use OCA\Text\AppInfo\Application;
use OCA\Text\Service\WorkspaceService;
use OCP\Files\IRootFolder;
+use OCP\IConfig;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\Server;
@@ -37,7 +39,7 @@ use Sabre\DAV\ServerPlugin;
class WorkspacePlugin extends ServerPlugin {
- public const WORKSPACE = '{http://nextcloud.org/ns}rich-workspace';
+ public const WORKSPACE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace';
/** @var Server */
private $server;
@@ -48,12 +50,16 @@ class WorkspacePlugin extends ServerPlugin {
/** @var IRootFolder */
private $rootFolder;
+ /** @var IConfig */
+ private $config;
+
/** @var string|null */
private $userId;
- public function __construct(WorkspaceService $workspaceService, IRootFolder $rootFolder, $userId) {
+ public function __construct(WorkspaceService $workspaceService, IRootFolder $rootFolder, IConfig $config, $userId) {
$this->workspaceService = $workspaceService;
$this->rootFolder = $rootFolder;
+ $this->config = $config;
$this->userId = $userId;
}
@@ -80,7 +86,14 @@ class WorkspacePlugin extends ServerPlugin {
return;
}
- $propFind->handle(self::WORKSPACE, function () use ($node) {
+ $workspaceAvailable = $this->config->getAppValue(Application::APP_NAME, 'workspace_available', '1') === '1';
+ $workspaceEnabled = $this->config->getUserValue($this->userId, Application::APP_NAME, 'workspace_enabled', '1') === '1';
+
+ if (!$workspaceAvailable || !$workspaceEnabled) {
+ return;
+ }
+
+ $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) {
/** @var Folder[] $nodes */
$nodes = $this->rootFolder->getUserFolder($this->userId)->getById($node->getId());
if (count($nodes) > 0) {
@@ -90,6 +103,7 @@ class WorkspacePlugin extends ServerPlugin {
return $file->getContent();
}
}
+ return '';
});
}