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 | |
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')
-rw-r--r-- | apps/dav/appinfo/v1/publicwebdav.php | 3 | ||||
-rw-r--r-- | apps/dav/appinfo/v1/webdav.php | 3 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ServerFactory.php | 23 | ||||
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php | 3 |
4 files changed, 27 insertions, 5 deletions
diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index 1fe5d57b2a0..03bd25b0fce 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -52,7 +52,8 @@ $serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory( \OC::$server->getMountManager(), \OC::$server->getTagManager(), \OC::$server->getRequest(), - \OC::$server->getPreviewManager() + \OC::$server->getPreviewManager(), + \OC::$server->getEventDispatcher() ); $requestUri = \OC::$server->getRequest()->getRequestUri(); diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php index e1f85e63b26..605ae1a0edb 100644 --- a/apps/dav/appinfo/v1/webdav.php +++ b/apps/dav/appinfo/v1/webdav.php @@ -44,7 +44,8 @@ $serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory( \OC::$server->getMountManager(), \OC::$server->getTagManager(), \OC::$server->getRequest(), - \OC::$server->getPreviewManager() + \OC::$server->getPreviewManager(), + \OC::$server->getEventDispatcher() ); // Backends 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; } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php index 1eac5f4e3a8..5d56f9c667d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php @@ -67,7 +67,8 @@ abstract class RequestTestCase extends TestCase { $this->getMockBuilder(IRequest::class) ->disableOriginalConstructor() ->getMock(), - \OC::$server->getPreviewManager() + \OC::$server->getPreviewManager(), + \OC::$server->getEventDispatcher() ); } |