In debugging mode we enable Sabre's browser plugin since it helps a lot when debugging

This commit is contained in:
Thomas Müller 2016-03-17 16:51:19 +01:00
parent 8fb3e44610
commit 7d638fdb34
3 changed files with 26 additions and 9 deletions

View File

@ -23,6 +23,7 @@
// Backends
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\Connector\LegacyDAVACL;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
@ -43,12 +44,14 @@ $principalBackend = new Principal(
$db = \OC::$server->getDatabaseConnection();
$calDavBackend = new CalDavBackend($db, $principalBackend);
$debugging = \OC::$server->getConfig()->getSystemValue('debug', false);
// Root nodes
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
$principalCollection->disableListing = true; // Disable listing
$principalCollection->disableListing = !$debugging; // Disable listing
$addressBookRoot = new CalendarRoot($principalBackend, $calDavBackend);
$addressBookRoot->disableListing = true; // Disable listing
$addressBookRoot->disableListing = !$debugging; // Disable listing
$nodes = array(
$principalCollection,
@ -65,8 +68,10 @@ $server->addPlugin(new MaintenancePlugin());
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud'));
$server->addPlugin(new \Sabre\CalDAV\Plugin());
$acl = new \OCA\DAV\Connector\LegacyDAVACL();
$server->addPlugin($acl);
$server->addPlugin(new LegacyDAVACL());
if ($debugging) {
$server->addPlugin(new Sabre\DAV\Browser\Plugin());
}
$server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
$server->addPlugin(new ExceptionLoggerPlugin('caldav', \OC::$server->getLogger()));

View File

@ -24,6 +24,7 @@
// Backends
use OCA\DAV\CardDAV\AddressBookRoot;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\Connector\LegacyDAVACL;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
@ -44,12 +45,14 @@ $principalBackend = new Principal(
$db = \OC::$server->getDatabaseConnection();
$cardDavBackend = new CardDavBackend($db, $principalBackend);
$debugging = \OC::$server->getConfig()->getSystemValue('debug', false);
// Root nodes
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
$principalCollection->disableListing = true; // Disable listing
$principalCollection->disableListing = !$debugging; // Disable listing
$addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend);
$addressBookRoot->disableListing = true; // Disable listing
$addressBookRoot->disableListing = !$debugging; // Disable listing
$nodes = array(
$principalCollection,
@ -65,8 +68,10 @@ $server->addPlugin(new MaintenancePlugin());
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud'));
$server->addPlugin(new Plugin());
$acl = new \OCA\DAV\Connector\LegacyDAVACL();
$server->addPlugin($acl);
$server->addPlugin(new LegacyDAVACL());
if ($debugging) {
$server->addPlugin(new Sabre\DAV\Browser\Plugin());
}
$server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
$server->addPlugin(new ExceptionLoggerPlugin('carddav', \OC::$server->getLogger()));

View File

@ -28,6 +28,7 @@ use OCA\DAV\Connector\FedAuth;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
use OCA\DAV\Connector\Sabre\DavAclPlugin;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\DAV\Files\CustomPropertiesBackend;
use OCP\IRequest;
@ -68,7 +69,13 @@ class Server {
$event = new SabrePluginEvent($this->server);
$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
// debugging
if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
$this->server->addPlugin(new \Sabre\DAV\Browser\Plugin());
} else {
$this->server->addPlugin(new DummyGetResponsePlugin());
}
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger));
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin());
$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());