$rootInfo = $view->getFileInfo('');
// Create ownCloud Dir
+ $mountManager = \OC\Files\Filesystem::getMountManager();
$rootDir = new OC_Connector_Sabre_Directory($view, $rootInfo);
- $objectTree->init($rootDir, $view);
+ $objectTree->init($rootDir, $view, $mountManager);
$server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin($view));
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
$view = new \OC\Files\View($root);
$publicDir = new OC_Connector_Sabre_Directory($view, $view->getFileInfo(''));
$objectTree = new \OC\Connector\Sabre\ObjectTree();
- $objectTree->init($publicDir, $view);
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $objectTree->init($publicDir, $view, $mountManager);
// Fire up server
$server = new \Sabre\DAV\Server($publicDir);
} else {
$root = new OC_Connector_Sabre_File($view, $rootInfo);
}
- $objectTree->init($root, $view);
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $objectTree->init($root, $view, $mountManager);
$server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin($view));
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
use OC\Files\FileInfo;
use OC\Files\Filesystem;
+use OC\Files\Mount\MoveableMount;
class ObjectTree extends \Sabre\DAV\ObjectTree {
*/
protected $fileView;
+ /**
+ * @var \OC\Files\Mount\Manager
+ */
+ protected $mountManager;
+
/**
* Creates the object
*
/**
* @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;
}
/**
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) {
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();
}
}
->will($this->returnValue(false));
/** @var $objectTree \OC\Connector\Sabre\ObjectTree */
- $objectTree->init($rootDir, $view);
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $objectTree->init($rootDir, $view, $mountManager);
$objectTree->move($source, $dest);
}