summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-06-17 14:10:11 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-17 14:10:11 +0200
commit07fdeba50b47848c995d38408635020e08cecb19 (patch)
treee1c8fd8432c11f3de08b01334250c48541a2fa6d /lib/private
parent2219087df6b3226e257547e5a02e120486ab4579 (diff)
downloadnextcloud-server-07fdeba50b47848c995d38408635020e08cecb19.tar.gz
nextcloud-server-07fdeba50b47848c995d38408635020e08cecb19.zip
Fix moving movablemount over webdav
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/connector/sabre/objecttree.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php
index 2cadb5af520..f2578e3c097 100644
--- a/lib/private/connector/sabre/objecttree.php
+++ b/lib/private/connector/sabre/objecttree.php
@@ -10,6 +10,7 @@ namespace OC\Connector\Sabre;
use OC\Files\FileInfo;
use OC\Files\Filesystem;
+use OC\Files\Mount\MoveableMount;
class ObjectTree extends \Sabre\DAV\ObjectTree {
@@ -19,6 +20,11 @@ class ObjectTree extends \Sabre\DAV\ObjectTree {
protected $fileView;
/**
+ * @var \OC\Files\Mount\Manager
+ */
+ protected $mountManager;
+
+ /**
* Creates the object
*
* This method expects the rootObject to be passed as a parameter
@@ -29,10 +35,12 @@ class ObjectTree extends \Sabre\DAV\ObjectTree {
/**
* @param \Sabre\DAV\ICollection $rootNode
* @param \OC\Files\View $view
+ * @param \OC\Files\Mount\Manager $mountManager
*/
- public function init(\Sabre\DAV\ICollection $rootNode, \OC\Files\View $view) {
+ public function init(\Sabre\DAV\ICollection $rootNode, \OC\Files\View $view, \OC\Files\Mount\Manager $mountManager) {
$this->rootNode = $rootNode;
$this->fileView = $view;
+ $this->mountManager = $mountManager;
}
/**
@@ -115,14 +123,15 @@ class ObjectTree extends \Sabre\DAV\ObjectTree {
list($sourceDir,) = \Sabre\DAV\URLUtil::splitPath($sourcePath);
list($destinationDir,) = \Sabre\DAV\URLUtil::splitPath($destinationPath);
- $isShareMountPoint = false;
- list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath( '/' . \OCP\User::getUser() . '/files/' . $sourcePath);
- if ($storage instanceof \OCA\Files_Sharing\ISharedStorage && !$internalPath) {
- $isShareMountPoint = true;
+ $isMovableMount = false;
+ $sourceMount = $this->mountManager->find($this->fileView->getAbsolutePath($sourcePath));
+ $internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
+ if ($sourceMount instanceof MoveableMount && $internalPath === '') {
+ $isMovableMount = true;
}
// check update privileges
- if (!$this->fileView->isUpdatable($sourcePath) && !$isShareMountPoint) {
+ if (!$this->fileView->isUpdatable($sourcePath) && !$isMovableMount) {
throw new \Sabre\DAV\Exception\Forbidden();
}
if ($sourceDir !== $destinationDir) {
@@ -132,7 +141,7 @@ class ObjectTree extends \Sabre\DAV\ObjectTree {
if (!$this->fileView->isUpdatable($destinationDir)) {
throw new \Sabre\DAV\Exception\Forbidden();
}
- if (!$this->fileView->isDeletable($sourcePath)) {
+ if (!$this->fileView->isDeletable($sourcePath) && !$isMovableMount) {
throw new \Sabre\DAV\Exception\Forbidden();
}
}