summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-21 13:03:48 +0100
committerGitHub <noreply@github.com>2016-12-21 13:03:48 +0100
commit591b60d11cd5e2aa451bb9e08e3c1ed28300b704 (patch)
tree6db4f831c9eff94127a1f77370575e95fea2e38c /apps/dav
parent091bf07385a6e850383ee8364e282a5bbac6adc2 (diff)
parent29a1ebc3627795a38d3149307d57b89488bcff0f (diff)
downloadnextcloud-server-591b60d11cd5e2aa451bb9e08e3c1ed28300b704.tar.gz
nextcloud-server-591b60d11cd5e2aa451bb9e08e3c1ed28300b704.zip
Merge pull request #2758 from nextcloud/only-one-dav-backend
Register only one dav backend
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesReportPlugin.php12
-rw-r--r--apps/dav/lib/Files/RootCollection.php1
-rw-r--r--apps/dav/lib/Server.php40
3 files changed, 28 insertions, 25 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
index bc0c1c2f603..81c082b9105 100644
--- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
@@ -24,9 +24,7 @@
namespace OCA\DAV\Connector\Sabre;
use OC\Files\View;
-use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Exception\PreconditionFailed;
-use Sabre\DAV\Exception\ReportNotSupported;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\ServerPlugin;
use Sabre\DAV\Tree;
@@ -105,7 +103,7 @@ class FilesReportPlugin extends ServerPlugin {
* @param ITagManager $fileTagger manager for private tags
* @param IUserSession $userSession
* @param IGroupManager $groupManager
- * @param Folder $userfolder
+ * @param Folder $userFolder
*/
public function __construct(Tree $tree,
View $view,
@@ -161,11 +159,12 @@ class FilesReportPlugin extends ServerPlugin {
* REPORT operations to look for files
*
* @param string $reportName
- * @param [] $report
+ * @param $report
* @param string $uri
* @return bool
- * @throws NotFound
- * @throws ReportNotSupported
+ * @throws BadRequest
+ * @throws PreconditionFailed
+ * @internal param $ [] $report
*/
public function onReport($reportName, $report, $uri) {
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
@@ -232,7 +231,6 @@ class FilesReportPlugin extends ServerPlugin {
private function getFilesBaseUri($uri, $subPath) {
$uri = trim($uri, '/');
$subPath = trim($subPath, '/');
- $filesUri = '';
if (empty($subPath)) {
$filesUri = $uri;
} else {
diff --git a/apps/dav/lib/Files/RootCollection.php b/apps/dav/lib/Files/RootCollection.php
index 345015530e2..c73d7c175ce 100644
--- a/apps/dav/lib/Files/RootCollection.php
+++ b/apps/dav/lib/Files/RootCollection.php
@@ -21,6 +21,7 @@
*/
namespace OCA\DAV\Files;
+use Sabre\DAV\INode;
use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\HTTP\URLUtil;
use Sabre\DAV\SimpleCollection;
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index 1205d018241..79c4301a8d8 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -33,11 +33,14 @@ use OCA\DAV\CardDAV\ImageExportPlugin;
use OCA\DAV\Comments\CommentsPlugin;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
+use OCA\DAV\Connector\Sabre\CommentPropertiesPlugin;
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
use OCA\DAV\Connector\Sabre\DavAclPlugin;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
use OCA\DAV\Connector\Sabre\FilesPlugin;
+use OCA\DAV\Connector\Sabre\FilesReportPlugin;
+use OCA\DAV\Connector\Sabre\SharesPlugin;
use OCA\DAV\DAV\PublicAuth;
use OCA\DAV\Connector\Sabre\QuotaPlugin;
use OCA\DAV\Files\BrowserErrorPagePlugin;
@@ -85,7 +88,6 @@ class Server {
$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig()));
$authPlugin = new Plugin();
- $authPlugin->addBackend($authBackend);
$authPlugin->addBackend(new PublicAuth());
$this->server->addPlugin($authPlugin);
@@ -166,7 +168,7 @@ class Server {
// custom properties plugin must be the last one
$userSession = \OC::$server->getUserSession();
$user = $userSession->getUser();
- if (!is_null($user)) {
+ if ($user !== null) {
$view = \OC\Files\Filesystem::getView();
$this->server->addPlugin(
new FilesPlugin(
@@ -188,9 +190,10 @@ class Server {
)
)
);
- $this->server->addPlugin(
- new QuotaPlugin($view)
- );
+ if ($view !== null) {
+ $this->server->addPlugin(
+ new QuotaPlugin($view));
+ }
$this->server->addPlugin(
new TagsPlugin(
$this->server->tree, \OC::$server->getTagManager()
@@ -198,28 +201,29 @@ class Server {
);
// TODO: switch to LazyUserFolder
$userFolder = \OC::$server->getUserFolder();
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin(
+ $this->server->addPlugin(new SharesPlugin(
$this->server->tree,
$userSession,
$userFolder,
\OC::$server->getShareManager()
));
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin(
+ $this->server->addPlugin(new CommentPropertiesPlugin(
\OC::$server->getCommentsManager(),
$userSession
));
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesReportPlugin(
- $this->server->tree,
- $view,
- \OC::$server->getSystemTagManager(),
- \OC::$server->getSystemTagObjectMapper(),
- \OC::$server->getTagManager(),
- $userSession,
- \OC::$server->getGroupManager(),
- $userFolder
- ));
+ 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(),
+ $userFolder
+ ));
+ }
}
- $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin());
});
}