diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-12-16 13:38:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-16 13:38:38 +0100 |
commit | 8d7baaff7494194f2a8e0fe8d9baf981d15d5a76 (patch) | |
tree | 9c163b7e5ee2a0fe2d68483f56afb06b7878217b /apps/dav/lib/Connector/Sabre | |
parent | faf58e4cacf6475110e32c7e5c8f37971b641b1a (diff) | |
parent | 1593322397c02c84976657faac9d134d561565a0 (diff) | |
download | nextcloud-server-8d7baaff7494194f2a8e0fe8d9baf981d15d5a76.tar.gz nextcloud-server-8d7baaff7494194f2a8e0fe8d9baf981d15d5a76.zip |
Merge pull request #18061 from nextcloud/bugfix/noid/dav-plugin-old
Load apps dav plugins on the old webdav route
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ServerFactory.php | 23 |
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 83badbc5b29..53ca0d277c8 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -31,6 +31,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; @@ -40,7 +41,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 */ @@ -59,6 +62,8 @@ class ServerFactory { private $request; /** @var IPreview */ private $previewManager; + /** @var EventDispatcherInterface */ + private $eventDispatcher; /** * @param IConfig $config @@ -78,7 +83,8 @@ class ServerFactory { IMountManager $mountManager, ITagManager $tagManager, IRequest $request, - IPreview $previewManager + IPreview $previewManager, + EventDispatcherInterface $eventDispatcher ) { $this->config = $config; $this->logger = $logger; @@ -88,6 +94,7 @@ class ServerFactory { $this->tagManager = $tagManager; $this->request = $request; $this->previewManager = $previewManager; + $this->eventDispatcher = $eventDispatcher; } /** @@ -135,7 +142,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()) { @@ -196,6 +203,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; } |