summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-06-04 17:20:00 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-14 10:14:07 +0200
commit64ced76bebfab1607cbd44819b03242efdc17a9c (patch)
tree9e7bbaa072a3ab5fab5fa7ca52dd114d588854c7
parent43c56fcd07f610196d2704158978acca566f5776 (diff)
downloadnextcloud-server-64ced76bebfab1607cbd44819b03242efdc17a9c.tar.gz
nextcloud-server-64ced76bebfab1607cbd44819b03242efdc17a9c.zip
Save mountpoints relative to the user
-rw-r--r--apps/files_sharing/lib/external/manager.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php
index 47fc220f7de..75edf73059c 100644
--- a/apps/files_sharing/lib/external/manager.php
+++ b/apps/files_sharing/lib/external/manager.php
@@ -8,6 +8,7 @@
namespace OCA\Files_Sharing\External;
+use OC\Files\Filesystem;
use OC\Files\Mount\Mount;
class Manager {
@@ -52,7 +53,7 @@ class Manager {
if ($user) {
$query = $this->connection->prepare('INSERT INTO *PREFIX*share_external(`remote`, `share_token`, `password`,
`name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`) VALUES(?, ?, ?, ?, ?, ?, ?, ?)');
- $mountPoint = '/' . $user->getUID() . '/files/' . $name;
+ $mountPoint = Filesystem::normalizePath('/' . $name);
$hash = md5($mountPoint);
$query->execute(array($remote, $token, $password, $name, $owner, $user->getUID(), $mountPoint, $hash));
@@ -63,9 +64,7 @@ class Manager {
'mountpoint' => $mountPoint,
'owner' => $owner
);
- $mount = new Mount(self::STORAGE, $mountPoint, $options, $this->storageLoader);
- $this->mountManager->addMount($mount);
- return $mount;
+ return $this->mountShare($options);
}
}
@@ -79,13 +78,23 @@ class Manager {
while ($row = $query->fetch()) {
$row['manager'] = $this;
$row['token'] = $row['share_token'];
- $mount = new Mount(self::STORAGE, $row['mountpoint'], $row, $this->storageLoader);
- $this->mountManager->addMount($mount);
+ $this->mountShare($row);
}
}
}
/**
+ * @param array $data
+ * @return Mount
+ */
+ protected function mountShare($data) {
+ $mountPoint = '/' . $this->userSession->getUser()->getUID() . '/files' . $data['mountpoint'];
+ $mount = new Mount(self::STORAGE, $mountPoint, $data, $this->storageLoader);
+ $this->mountManager->addMount($mount);
+ return $mount;
+ }
+
+ /**
* @return \OC\Files\Mount\Manager
*/
public function getMountManager() {