2015-10-21 16:06:48 +03:00
|
|
|
<?php
|
2016-01-12 17:02:16 +03:00
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Bjoern Schiessle <bjoern@schiessle.org>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Brandon Kirsch <brandonkirsch@github.com>
|
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2017-11-06 22:15:27 +03:00
|
|
|
* @author Georg Ehrke <oc.list@georgehrke.com>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Lukas Reschke <lukas@statuscode.ch>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2016-07-21 19:13:36 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2016-07-21 17:49:16 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2020-04-29 12:57:22 +03:00
|
|
|
* @author Thomas Citharel <nextcloud@tcit.fr>
|
2016-01-12 17:02:16 +03:00
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
2020-12-16 16:54:15 +03:00
|
|
|
* @author Vincent Petry <vincent@nextcloud.com>
|
2016-01-12 17:02:16 +03:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2016-01-12 17:02:16 +03:00
|
|
|
*
|
|
|
|
*/
|
2019-11-22 22:52:10 +03:00
|
|
|
|
2015-10-21 16:06:48 +03:00
|
|
|
namespace OCA\DAV;
|
|
|
|
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\DAV\AppInfo\PluginManager;
|
2017-11-11 04:02:17 +03:00
|
|
|
use OCA\DAV\CalDAV\BirthdayService;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\DAV\CardDAV\HasPhotoPlugin;
|
2016-06-21 16:25:44 +03:00
|
|
|
use OCA\DAV\CardDAV\ImageExportPlugin;
|
2018-10-24 09:22:31 +03:00
|
|
|
use OCA\DAV\CardDAV\MultiGetExportPlugin;
|
2017-05-03 15:22:02 +03:00
|
|
|
use OCA\DAV\CardDAV\PhotoCache;
|
2016-09-23 20:57:07 +03:00
|
|
|
use OCA\DAV\Comments\CommentsPlugin;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin;
|
2015-10-21 16:06:48 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\Auth;
|
2017-05-18 21:09:51 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\BearerAuth;
|
2015-10-21 16:06:48 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
2017-06-14 19:11:55 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\CachingTree;
|
2016-11-08 12:03:25 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\CommentPropertiesPlugin;
|
2016-09-23 20:57:07 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
|
2016-02-29 19:30:02 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\DavAclPlugin;
|
2016-03-17 18:51:19 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
|
2016-09-23 20:57:07 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
|
2016-02-18 22:11:59 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\FilesPlugin;
|
2016-11-08 12:03:25 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\FilesReportPlugin;
|
2020-04-02 16:17:04 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\PropfindCompressionPlugin;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\QuotaPlugin;
|
2016-11-08 12:03:25 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\SharesPlugin;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\DAV\Connector\Sabre\TagsPlugin;
|
2017-03-27 20:15:51 +03:00
|
|
|
use OCA\DAV\DAV\CustomPropertiesBackend;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OCA\DAV\DAV\PublicAuth;
|
2020-10-27 17:23:27 +03:00
|
|
|
use OCA\DAV\Events\SabrePluginAuthInitEvent;
|
2016-03-24 16:29:55 +03:00
|
|
|
use OCA\DAV\Files\BrowserErrorPagePlugin;
|
2018-06-28 15:53:44 +03:00
|
|
|
use OCA\DAV\Files\LazySearchBackend;
|
2017-10-19 13:57:20 +03:00
|
|
|
use OCA\DAV\Provisioning\Apple\AppleProvisioningPlugin;
|
2016-09-23 20:57:07 +03:00
|
|
|
use OCA\DAV\SystemTag\SystemTagPlugin;
|
2017-07-31 23:46:19 +03:00
|
|
|
use OCA\DAV\Upload\ChunkingPlugin;
|
2020-10-27 17:23:27 +03:00
|
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
2015-10-21 16:06:48 +03:00
|
|
|
use OCP\IRequest;
|
2015-12-04 14:11:07 +03:00
|
|
|
use OCP\SabrePluginEvent;
|
2016-04-10 13:43:15 +03:00
|
|
|
use Sabre\CardDAV\VCFExportPlugin;
|
2015-10-21 16:06:48 +03:00
|
|
|
use Sabre\DAV\Auth\Plugin;
|
2017-10-19 13:57:20 +03:00
|
|
|
use Sabre\DAV\UUIDUtil;
|
2017-02-02 20:20:08 +03:00
|
|
|
use SearchDAV\DAV\SearchPlugin;
|
2015-10-21 16:06:48 +03:00
|
|
|
|
|
|
|
class Server {
|
|
|
|
|
|
|
|
/** @var IRequest */
|
|
|
|
private $request;
|
|
|
|
|
2016-07-05 23:45:05 +03:00
|
|
|
/** @var string */
|
|
|
|
private $baseUri;
|
|
|
|
|
|
|
|
/** @var Connector\Sabre\Server */
|
2018-04-23 14:54:58 +03:00
|
|
|
public $server;
|
2016-07-05 23:45:05 +03:00
|
|
|
|
2015-10-21 16:06:48 +03:00
|
|
|
public function __construct(IRequest $request, $baseUri) {
|
|
|
|
$this->request = $request;
|
|
|
|
$this->baseUri = $baseUri;
|
2015-11-16 18:09:04 +03:00
|
|
|
$logger = \OC::$server->getLogger();
|
2016-01-13 13:54:42 +03:00
|
|
|
$dispatcher = \OC::$server->getEventDispatcher();
|
2020-10-27 17:23:27 +03:00
|
|
|
/** @var IEventDispatcher $newDispatcher */
|
|
|
|
$newDispatcher = \OC::$server->query(IEventDispatcher::class);
|
2015-11-16 18:09:04 +03:00
|
|
|
|
2015-10-21 16:06:48 +03:00
|
|
|
$root = new RootCollection();
|
2017-06-14 19:11:55 +03:00
|
|
|
$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
|
2015-10-21 16:06:48 +03:00
|
|
|
|
2017-04-11 01:57:31 +03:00
|
|
|
// Add maintenance plugin
|
2020-05-06 19:11:54 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav')));
|
2017-04-11 01:57:31 +03:00
|
|
|
|
2015-10-21 16:06:48 +03:00
|
|
|
// Backends
|
2015-10-26 15:02:10 +03:00
|
|
|
$authBackend = new Auth(
|
|
|
|
\OC::$server->getSession(),
|
2016-02-16 15:16:52 +03:00
|
|
|
\OC::$server->getUserSession(),
|
2016-06-01 11:42:38 +03:00
|
|
|
\OC::$server->getRequest(),
|
2016-07-20 19:36:15 +03:00
|
|
|
\OC::$server->getTwoFactorAuthManager(),
|
|
|
|
\OC::$server->getBruteForceThrottler()
|
2015-10-26 15:02:10 +03:00
|
|
|
);
|
2015-10-21 16:06:48 +03:00
|
|
|
|
|
|
|
// Set URL explicitly due to reverse-proxy situations
|
|
|
|
$this->server->httpRequest->setUrl($this->request->getRequestUri());
|
|
|
|
$this->server->setBaseUri($this->baseUri);
|
|
|
|
|
|
|
|
$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
|
2018-05-22 14:40:54 +03:00
|
|
|
$this->server->addPlugin(new AnonymousOptionsPlugin());
|
2016-10-20 13:51:54 +03:00
|
|
|
$authPlugin = new Plugin();
|
|
|
|
$authPlugin->addBackend(new PublicAuth());
|
|
|
|
$this->server->addPlugin($authPlugin);
|
2015-12-04 14:11:07 +03:00
|
|
|
|
|
|
|
// allow setup of additional auth backends
|
|
|
|
$event = new SabrePluginEvent($this->server);
|
|
|
|
$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
|
|
|
|
|
2020-10-28 15:24:17 +03:00
|
|
|
$newAuthEvent = new SabrePluginAuthInitEvent($this->server);
|
|
|
|
$newDispatcher->dispatchTyped($newAuthEvent);
|
2020-10-27 17:23:27 +03:00
|
|
|
|
2017-05-18 21:09:51 +03:00
|
|
|
$bearerAuthBackend = new BearerAuth(
|
|
|
|
\OC::$server->getUserSession(),
|
|
|
|
\OC::$server->getSession(),
|
|
|
|
\OC::$server->getRequest()
|
|
|
|
);
|
|
|
|
$authPlugin->addBackend($bearerAuthBackend);
|
2016-07-14 17:19:31 +03:00
|
|
|
// because we are throwing exceptions this plugin has to be the last one
|
|
|
|
$authPlugin->addBackend($authBackend);
|
|
|
|
|
2016-03-17 18:51:19 +03:00
|
|
|
// debugging
|
2020-04-10 15:19:56 +03:00
|
|
|
if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
|
2016-03-17 18:51:19 +03:00
|
|
|
$this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
|
|
|
|
} else {
|
|
|
|
$this->server->addPlugin(new DummyGetResponsePlugin());
|
|
|
|
}
|
|
|
|
|
2015-11-16 18:09:04 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
|
|
|
|
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
|
2015-11-23 15:53:57 +03:00
|
|
|
$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
|
2015-10-21 16:06:48 +03:00
|
|
|
|
2015-11-24 13:15:31 +03:00
|
|
|
// acl
|
2016-02-29 19:30:02 +03:00
|
|
|
$acl = new DavAclPlugin();
|
2016-05-02 15:19:10 +03:00
|
|
|
$acl->principalCollectionSet = [
|
2019-08-06 14:40:52 +03:00
|
|
|
'principals/users',
|
|
|
|
'principals/groups',
|
2018-05-28 21:12:13 +03:00
|
|
|
'principals/calendar-resources',
|
|
|
|
'principals/calendar-rooms',
|
2016-05-02 15:19:10 +03:00
|
|
|
];
|
2015-11-24 13:15:31 +03:00
|
|
|
$acl->defaultUsernamePath = 'principals/users';
|
|
|
|
$this->server->addPlugin($acl);
|
|
|
|
|
2015-10-31 03:28:21 +03:00
|
|
|
// calendar plugins
|
2018-05-28 21:12:13 +03:00
|
|
|
if ($this->requestIsForSubtree(['calendars', 'public-calendars', 'system-calendars', 'principals'])) {
|
2018-04-23 10:50:13 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
|
2019-11-26 12:56:42 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin(\OC::$server->getConfig(), \OC::$server->getLogger()));
|
2020-03-08 19:33:27 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig()));
|
2018-04-23 10:50:13 +03:00
|
|
|
if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
|
|
|
|
$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
|
|
|
|
}
|
2018-06-28 14:07:33 +03:00
|
|
|
|
2021-03-12 13:20:04 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Trashbin\Plugin($request));
|
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\WebcalCaching\Plugin($request));
|
2018-04-23 10:50:13 +03:00
|
|
|
$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
|
2018-06-28 14:07:33 +03:00
|
|
|
|
2018-04-23 10:50:13 +03:00
|
|
|
$this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
|
2020-08-11 10:24:08 +03:00
|
|
|
$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest(), \OC::$server->getConfig()));
|
2018-04-23 10:50:13 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
|
|
|
|
\OC::$server->getConfig(),
|
|
|
|
\OC::$server->getURLGenerator()
|
|
|
|
));
|
2017-10-11 14:14:56 +03:00
|
|
|
}
|
2015-11-09 15:27:19 +03:00
|
|
|
|
2015-10-31 03:28:21 +03:00
|
|
|
// addressbook plugins
|
2018-04-23 14:54:58 +03:00
|
|
|
if ($this->requestIsForSubtree(['addressbooks', 'principals'])) {
|
2020-08-11 10:24:08 +03:00
|
|
|
$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest(), \OC::$server->getConfig()));
|
2018-04-23 10:50:13 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
|
|
|
|
$this->server->addPlugin(new VCFExportPlugin());
|
2018-10-24 09:22:31 +03:00
|
|
|
$this->server->addPlugin(new MultiGetExportPlugin());
|
2019-02-26 19:19:26 +03:00
|
|
|
$this->server->addPlugin(new HasPhotoPlugin());
|
2018-12-17 19:28:19 +03:00
|
|
|
$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(
|
|
|
|
\OC::$server->getAppDataDir('dav-photocache'),
|
|
|
|
\OC::$server->getLogger())
|
|
|
|
));
|
2018-04-23 10:50:13 +03:00
|
|
|
}
|
2015-11-10 09:27:34 +03:00
|
|
|
|
2015-11-27 14:54:31 +03:00
|
|
|
// system tags plugins
|
2016-09-23 20:57:07 +03:00
|
|
|
$this->server->addPlugin(new SystemTagPlugin(
|
2016-02-19 21:45:03 +03:00
|
|
|
\OC::$server->getSystemTagManager(),
|
|
|
|
\OC::$server->getGroupManager(),
|
|
|
|
\OC::$server->getUserSession()
|
|
|
|
));
|
2015-11-27 14:54:31 +03:00
|
|
|
|
2016-01-11 20:09:00 +03:00
|
|
|
// comments plugin
|
2016-09-23 20:57:07 +03:00
|
|
|
$this->server->addPlugin(new CommentsPlugin(
|
2016-01-11 20:09:00 +03:00
|
|
|
\OC::$server->getCommentsManager(),
|
|
|
|
\OC::$server->getUserSession()
|
|
|
|
));
|
|
|
|
|
2016-09-23 20:57:07 +03:00
|
|
|
$this->server->addPlugin(new CopyEtagHeaderPlugin());
|
2017-07-31 23:46:19 +03:00
|
|
|
$this->server->addPlugin(new ChunkingPlugin());
|
2016-09-23 20:57:07 +03:00
|
|
|
|
2017-08-30 13:15:01 +03:00
|
|
|
// allow setup of additional plugins
|
|
|
|
$dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event);
|
|
|
|
|
2016-01-26 19:31:01 +03:00
|
|
|
// Some WebDAV clients do require Class 2 WebDAV support (locking), since
|
|
|
|
// we do not provide locking we emulate it using a fake locking plugin.
|
2020-04-10 15:19:56 +03:00
|
|
|
if ($request->isUserAgent([
|
2016-01-26 19:31:01 +03:00
|
|
|
'/WebDAVFS/',
|
2018-03-26 22:32:12 +03:00
|
|
|
'/OneNote/',
|
2017-03-07 19:24:26 +03:00
|
|
|
'/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601
|
2016-01-26 19:31:01 +03:00
|
|
|
])) {
|
2016-09-23 20:57:07 +03:00
|
|
|
$this->server->addPlugin(new FakeLockerPlugin());
|
2015-11-13 13:47:32 +03:00
|
|
|
}
|
|
|
|
|
2016-03-24 16:29:55 +03:00
|
|
|
if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
|
|
|
|
$this->server->addPlugin(new BrowserErrorPagePlugin());
|
|
|
|
}
|
|
|
|
|
2018-06-28 15:53:44 +03:00
|
|
|
$lazySearchBackend = new LazySearchBackend();
|
|
|
|
$this->server->addPlugin(new SearchPlugin($lazySearchBackend));
|
|
|
|
|
2015-10-21 16:06:48 +03:00
|
|
|
// wait with registering these until auth is handled and the filesystem is setup
|
2020-03-09 18:32:04 +03:00
|
|
|
$this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend) {
|
2015-10-21 16:06:48 +03:00
|
|
|
// custom properties plugin must be the last one
|
2016-10-04 17:08:22 +03:00
|
|
|
$userSession = \OC::$server->getUserSession();
|
|
|
|
$user = $userSession->getUser();
|
2016-11-08 12:03:25 +03:00
|
|
|
if ($user !== null) {
|
2016-02-18 22:11:59 +03:00
|
|
|
$view = \OC\Files\Filesystem::getView();
|
2016-04-18 12:18:50 +03:00
|
|
|
$this->server->addPlugin(
|
|
|
|
new FilesPlugin(
|
|
|
|
$this->server->tree,
|
|
|
|
\OC::$server->getConfig(),
|
2016-06-09 12:29:20 +03:00
|
|
|
$this->request,
|
2016-07-26 14:15:12 +03:00
|
|
|
\OC::$server->getPreviewManager(),
|
2016-04-18 12:18:50 +03:00
|
|
|
false,
|
|
|
|
!\OC::$server->getConfig()->getSystemValue('debug', false)
|
|
|
|
)
|
|
|
|
);
|
2016-02-18 22:11:59 +03:00
|
|
|
|
2015-10-21 16:06:48 +03:00
|
|
|
$this->server->addPlugin(
|
|
|
|
new \Sabre\DAV\PropertyStorage\Plugin(
|
|
|
|
new CustomPropertiesBackend(
|
|
|
|
$this->server->tree,
|
|
|
|
\OC::$server->getDatabaseConnection(),
|
|
|
|
\OC::$server->getUserSession()->getUser()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2016-11-08 12:03:25 +03:00
|
|
|
if ($view !== null) {
|
|
|
|
$this->server->addPlugin(
|
2017-09-13 14:12:16 +03:00
|
|
|
new QuotaPlugin($view, false));
|
2016-11-08 12:03:25 +03:00
|
|
|
}
|
2016-09-12 17:20:49 +03:00
|
|
|
$this->server->addPlugin(
|
|
|
|
new TagsPlugin(
|
|
|
|
$this->server->tree, \OC::$server->getTagManager()
|
|
|
|
)
|
|
|
|
);
|
2016-10-04 17:08:22 +03:00
|
|
|
// TODO: switch to LazyUserFolder
|
|
|
|
$userFolder = \OC::$server->getUserFolder();
|
2016-11-08 12:03:25 +03:00
|
|
|
$this->server->addPlugin(new SharesPlugin(
|
2016-10-04 17:08:22 +03:00
|
|
|
$this->server->tree,
|
|
|
|
$userSession,
|
|
|
|
$userFolder,
|
|
|
|
\OC::$server->getShareManager()
|
|
|
|
));
|
2016-11-08 12:03:25 +03:00
|
|
|
$this->server->addPlugin(new CommentPropertiesPlugin(
|
2016-10-04 17:08:22 +03:00
|
|
|
\OC::$server->getCommentsManager(),
|
|
|
|
$userSession
|
|
|
|
));
|
2017-03-25 13:56:40 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin());
|
2016-11-08 12:03:25 +03:00
|
|
|
if ($view !== null) {
|
|
|
|
$this->server->addPlugin(new FilesReportPlugin(
|
|
|
|
$this->server->tree,
|
|
|
|
$view,
|
|
|
|
\OC::$server->getSystemTagManager(),
|
|
|
|
\OC::$server->getSystemTagObjectMapper(),
|
|
|
|
\OC::$server->getTagManager(),
|
|
|
|
$userSession,
|
|
|
|
\OC::$server->getGroupManager(),
|
2019-03-13 02:42:39 +03:00
|
|
|
$userFolder,
|
|
|
|
\OC::$server->getAppManager()
|
2016-11-08 12:03:25 +03:00
|
|
|
));
|
2018-06-28 15:53:44 +03:00
|
|
|
$lazySearchBackend->setBackend(new \OCA\DAV\Files\FileSearchBackend(
|
2017-02-02 20:20:08 +03:00
|
|
|
$this->server->tree,
|
|
|
|
$user,
|
|
|
|
\OC::$server->getRootFolder(),
|
|
|
|
\OC::$server->getShareManager(),
|
|
|
|
$view
|
2018-06-28 15:53:44 +03:00
|
|
|
));
|
2016-11-08 12:03:25 +03:00
|
|
|
}
|
2017-10-20 17:53:02 +03:00
|
|
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
|
2017-11-11 04:02:17 +03:00
|
|
|
\OC::$server->getConfig(),
|
|
|
|
\OC::$server->query(BirthdayService::class)
|
2017-10-20 17:53:02 +03:00
|
|
|
));
|
2017-10-19 13:57:20 +03:00
|
|
|
$this->server->addPlugin(new AppleProvisioningPlugin(
|
|
|
|
\OC::$server->getUserSession(),
|
|
|
|
\OC::$server->getURLGenerator(),
|
|
|
|
\OC::$server->getThemingDefaults(),
|
|
|
|
\OC::$server->getRequest(),
|
|
|
|
\OC::$server->getL10N('dav'),
|
2020-04-09 14:53:40 +03:00
|
|
|
function () {
|
2017-10-19 13:57:20 +03:00
|
|
|
return UUIDUtil::getUUID();
|
|
|
|
}
|
|
|
|
));
|
2015-10-21 16:06:48 +03:00
|
|
|
}
|
2016-12-07 02:19:14 +03:00
|
|
|
|
|
|
|
// register plugins from apps
|
|
|
|
$pluginManager = new PluginManager(
|
|
|
|
\OC::$server,
|
|
|
|
\OC::$server->getAppManager()
|
|
|
|
);
|
|
|
|
foreach ($pluginManager->getAppPlugins() as $appPlugin) {
|
|
|
|
$this->server->addPlugin($appPlugin);
|
|
|
|
}
|
|
|
|
foreach ($pluginManager->getAppCollections() as $appCollection) {
|
|
|
|
$root->addChild($appCollection);
|
|
|
|
}
|
2015-10-21 16:06:48 +03:00
|
|
|
});
|
2020-04-02 16:17:04 +03:00
|
|
|
|
|
|
|
$this->server->addPlugin(
|
|
|
|
new PropfindCompressionPlugin()
|
|
|
|
);
|
2015-10-21 16:06:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function exec() {
|
|
|
|
$this->server->exec();
|
|
|
|
}
|
2018-04-23 10:50:13 +03:00
|
|
|
|
2018-04-23 14:54:58 +03:00
|
|
|
private function requestIsForSubtree(array $subTrees): bool {
|
|
|
|
foreach ($subTrees as $subTree) {
|
|
|
|
$subTree = trim($subTree, ' /');
|
|
|
|
if (strpos($this->server->getRequestUri(), $subTree.'/') === 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2018-04-23 10:50:13 +03:00
|
|
|
}
|
2015-10-21 16:06:48 +03:00
|
|
|
}
|