Save mountpoints relative to the user
This commit is contained in:
parent
43c56fcd07
commit
64ced76beb
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
namespace OCA\Files_Sharing\External;
|
namespace OCA\Files_Sharing\External;
|
||||||
|
|
||||||
|
use OC\Files\Filesystem;
|
||||||
use OC\Files\Mount\Mount;
|
use OC\Files\Mount\Mount;
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
|
@ -52,7 +53,7 @@ class Manager {
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$query = $this->connection->prepare('INSERT INTO *PREFIX*share_external(`remote`, `share_token`, `password`,
|
$query = $this->connection->prepare('INSERT INTO *PREFIX*share_external(`remote`, `share_token`, `password`,
|
||||||
`name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`) VALUES(?, ?, ?, ?, ?, ?, ?, ?)');
|
`name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`) VALUES(?, ?, ?, ?, ?, ?, ?, ?)');
|
||||||
$mountPoint = '/' . $user->getUID() . '/files/' . $name;
|
$mountPoint = Filesystem::normalizePath('/' . $name);
|
||||||
$hash = md5($mountPoint);
|
$hash = md5($mountPoint);
|
||||||
$query->execute(array($remote, $token, $password, $name, $owner, $user->getUID(), $mountPoint, $hash));
|
$query->execute(array($remote, $token, $password, $name, $owner, $user->getUID(), $mountPoint, $hash));
|
||||||
|
|
||||||
|
@ -63,9 +64,7 @@ class Manager {
|
||||||
'mountpoint' => $mountPoint,
|
'mountpoint' => $mountPoint,
|
||||||
'owner' => $owner
|
'owner' => $owner
|
||||||
);
|
);
|
||||||
$mount = new Mount(self::STORAGE, $mountPoint, $options, $this->storageLoader);
|
return $this->mountShare($options);
|
||||||
$this->mountManager->addMount($mount);
|
|
||||||
return $mount;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,12 +78,22 @@ class Manager {
|
||||||
while ($row = $query->fetch()) {
|
while ($row = $query->fetch()) {
|
||||||
$row['manager'] = $this;
|
$row['manager'] = $this;
|
||||||
$row['token'] = $row['share_token'];
|
$row['token'] = $row['share_token'];
|
||||||
$mount = new Mount(self::STORAGE, $row['mountpoint'], $row, $this->storageLoader);
|
$this->mountShare($row);
|
||||||
$this->mountManager->addMount($mount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
* @return \OC\Files\Mount\Manager
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue