Skip to content

Commit

Permalink
Merge pull request owncloud#14151 from owncloud/update-sabre2.1
Browse files Browse the repository at this point in the history
Sabre Update to 2.1
  • Loading branch information
DeepDiver1975 committed Feb 25, 2015
2 parents fb87b74 + b3de86d commit 799e144
Show file tree
Hide file tree
Showing 40 changed files with 1,557 additions and 1,781 deletions.
2 changes: 1 addition & 1 deletion 3rdparty
36 changes: 23 additions & 13 deletions apps/files/appinfo/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,47 @@
*
*/
// Backends
$authBackend = new OC_Connector_Sabre_Auth();
$lockBackend = new OC_Connector_Sabre_Locks();
$requestBackend = new OC_Connector_Sabre_Request();
$authBackend = new \OC\Connector\Sabre\Auth();

// Fire up server
$objectTree = new \OC\Connector\Sabre\ObjectTree();
$server = new OC_Connector_Sabre_Server($objectTree);
$server->httpRequest = $requestBackend;
$server = new \OC\Connector\Sabre\Server($objectTree);
// Set URL explicitly due to reverse-proxy situations
$server->httpRequest->setUrl(\OC::$server->getRequest()->getRequestUri());
$server->setBaseUri($baseuri);

// Load plugins
$defaults = new OC_Defaults();
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false, false)); // Show something in the Browser, but no upload
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
// FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
$server->addPlugin(new \OC\Connector\Sabre\DummyGetResponsePlugin());
$server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree));
$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin());
$server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav'));

// wait with registering these until auth is handled and the filesystem is setup
$server->subscribeEvent('beforeMethod', function () use ($server, $objectTree) {
$server->on('beforeMethod', function () use ($server, $objectTree) {
$view = \OC\Files\Filesystem::getView();
$rootInfo = $view->getFileInfo('');

// Create ownCloud Dir
$mountManager = \OC\Files\Filesystem::getMountManager();
$rootDir = new OC_Connector_Sabre_Directory($view, $rootInfo);
$rootDir = new \OC\Connector\Sabre\Directory($view, $rootInfo);
$objectTree->init($rootDir, $view, $mountManager);

$server->addPlugin(new \OC\Connector\Sabre\TagsPlugin($objectTree, \OC::$server->getTagManager()));
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
$server->addPlugin(new \OC\Connector\Sabre\QuotaPlugin($view));

// custom properties plugin must be the last one
$server->addPlugin(
new \Sabre\DAV\PropertyStorage\Plugin(
new \OC\Connector\Sabre\CustomPropertiesBackend(
$objectTree,
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserSession()->getUser()
)
)
);
}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request

// And off we go!
Expand Down
274 changes: 0 additions & 274 deletions apps/files_encryption/tests/webdav.php

This file was deleted.

22 changes: 10 additions & 12 deletions apps/files_sharing/publicwebdav.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,24 @@

// Backends
$authBackend = new OCA\Files_Sharing\Connector\PublicAuth(\OC::$server->getConfig());
$lockBackend = new OC_Connector_Sabre_Locks();
$requestBackend = new OC_Connector_Sabre_Request();

// Fire up server
$objectTree = new \OC\Connector\Sabre\ObjectTree();
$server = new OC_Connector_Sabre_Server($objectTree);
$server->httpRequest = $requestBackend;
$server = new \OC\Connector\Sabre\Server($objectTree);
// Set URL explicitly due to reverse-proxy situations
$server->httpRequest->setUrl(\OC::$server->getRequest()->getRequestUri());
$server->setBaseUri($baseuri);

// Load plugins
$defaults = new OC_Defaults();
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false)); // Show something in the Browser, but no upload
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
$server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree));
$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin());
$server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav'));

// wait with registering these until auth is handled and the filesystem is setup
$server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $authBackend) {
$server->on('beforeMethod', function () use ($server, $objectTree, $authBackend) {
$share = $authBackend->getShare();
$owner = $share['uid_owner'];
$isWritable = $share['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
Expand All @@ -74,14 +72,14 @@

// Create ownCloud Dir
if ($rootInfo->getType() === 'dir') {
$root = new OC_Connector_Sabre_Directory($view, $rootInfo);
$root = new \OC\Connector\Sabre\Directory($view, $rootInfo);
} else {
$root = new OC_Connector_Sabre_File($view, $rootInfo);
$root = new \OC\Connector\Sabre\File($view, $rootInfo);
}
$mountManager = \OC\Files\Filesystem::getMountManager();
$objectTree->init($root, $view, $mountManager);

$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
$server->addPlugin(new \OC\Connector\Sabre\QuotaPlugin($view));
}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request

// And off we go!
Expand Down
Loading

0 comments on commit 799e144

Please sign in to comment.