summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector/Sabre/ServerFactory.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-11-21 15:47:11 +0100
committerJulius Härtl <jus@bitgrid.net>2019-12-04 19:04:29 +0100
commit1593322397c02c84976657faac9d134d561565a0 (patch)
tree5c52cda412bfc34bf84f28b9361a9d51a347f15b /apps/dav/lib/Connector/Sabre/ServerFactory.php
parent17eece7fc4470828c3b03d44e0614e70848260a4 (diff)
downloadnextcloud-server-1593322397c02c84976657faac9d134d561565a0.tar.gz
nextcloud-server-1593322397c02c84976657faac9d134d561565a0.zip
Load apps dav plugins on the old webdav route
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/ServerFactory.php')
-rw-r--r--apps/dav/lib/Connector/Sabre/ServerFactory.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php
index 1821638189d..f1745dbd91a 100644
--- a/apps/dav/lib/Connector/Sabre/ServerFactory.php
+++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php
@@ -30,6 +30,7 @@
namespace OCA\DAV\Connector\Sabre;
use OC\Files\Node\Folder;
+use OCA\DAV\AppInfo\PluginManager;
use OCA\DAV\Files\BrowserErrorPagePlugin;
use OCP\Files\Mount\IMountManager;
use OCP\IConfig;
@@ -39,7 +40,9 @@ use OCP\IPreview;
use OCP\IRequest;
use OCP\ITagManager;
use OCP\IUserSession;
+use OCP\SabrePluginEvent;
use Sabre\DAV\Auth\Plugin;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class ServerFactory {
/** @var IConfig */
@@ -58,6 +61,8 @@ class ServerFactory {
private $request;
/** @var IPreview */
private $previewManager;
+ /** @var EventDispatcherInterface */
+ private $eventDispatcher;
/**
* @param IConfig $config
@@ -77,7 +82,8 @@ class ServerFactory {
IMountManager $mountManager,
ITagManager $tagManager,
IRequest $request,
- IPreview $previewManager
+ IPreview $previewManager,
+ EventDispatcherInterface $eventDispatcher
) {
$this->config = $config;
$this->logger = $logger;
@@ -87,6 +93,7 @@ class ServerFactory {
$this->tagManager = $tagManager;
$this->request = $request;
$this->previewManager = $previewManager;
+ $this->eventDispatcher = $eventDispatcher;
}
/**
@@ -134,7 +141,7 @@ class ServerFactory {
$server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
// ensure the skeleton is copied
$userFolder = \OC::$server->getUserFolder();
-
+
/** @var \OC\Files\View $view */
$view = $viewCallBack($server);
if ($userFolder instanceof Folder && $userFolder->getPath() === $view->getRoot()) {
@@ -195,6 +202,18 @@ class ServerFactory {
);
}
$server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
+
+ // Load dav plugins from apps
+ $event = new SabrePluginEvent($server);
+ $this->eventDispatcher->dispatch($event);
+ $pluginManager = new PluginManager(
+ \OC::$server,
+ \OC::$server->getAppManager()
+ );
+ foreach ($pluginManager->getAppPlugins() as $appPlugin) {
+ $server->addPlugin($appPlugin);
+ }
+
}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
return $server;
}