Fix multiple users having the same external share mountpoint
This commit is contained in:
parent
5b1b6572f7
commit
0616eb4007
|
@ -81,6 +81,10 @@
|
||||||
<index>
|
<index>
|
||||||
<name>sh_external_mp</name>
|
<name>sh_external_mp</name>
|
||||||
<unique>true</unique>
|
<unique>true</unique>
|
||||||
|
<field>
|
||||||
|
<name>user</name>
|
||||||
|
<sorting>ascending</sorting>
|
||||||
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>mountpoint_hash</name>
|
<name>mountpoint_hash</name>
|
||||||
<sorting>ascending</sorting>
|
<sorting>ascending</sorting>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.5.1
|
0.5.2
|
||||||
|
|
|
@ -117,22 +117,24 @@ class Manager {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setMountPoint($source, $target) {
|
public function setMountPoint($source, $target) {
|
||||||
|
$user = $this->userSession->getUser();
|
||||||
$source = $this->stripPath($source);
|
$source = $this->stripPath($source);
|
||||||
$target = $this->stripPath($target);
|
$target = $this->stripPath($target);
|
||||||
$sourceHash = md5($source);
|
$sourceHash = md5($source);
|
||||||
$targetHash = md5($target);
|
$targetHash = md5($target);
|
||||||
|
|
||||||
$query = $this->connection->prepare('UPDATE *PREFIX*share_external SET
|
$query = $this->connection->prepare('UPDATE *PREFIX*share_external SET
|
||||||
`mountpoint` = ?, `mountpoint_hash` = ? WHERE `mountpoint_hash` = ?');
|
`mountpoint` = ?, `mountpoint_hash` = ? WHERE `mountpoint_hash` = ? AND `user` = ?');
|
||||||
$result = (bool)$query->execute(array($target, $targetHash, $sourceHash));
|
$result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $user->getUID()));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeShare($mountPoint) {
|
public function removeShare($mountPoint) {
|
||||||
|
$user = $this->userSession->getUser();
|
||||||
$mountPoint = $this->stripPath($mountPoint);
|
$mountPoint = $this->stripPath($mountPoint);
|
||||||
$hash = md5($mountPoint);
|
$hash = md5($mountPoint);
|
||||||
$query = $this->connection->prepare('DELETE FROM *PREFIX*share_external WHERE `mountpoint_hash` = ?');
|
$query = $this->connection->prepare('DELETE FROM *PREFIX*share_external WHERE `mountpoint_hash` = ? AND `user` = ?');
|
||||||
return (bool)$query->execute(array($hash));
|
return (bool)$query->execute(array($hash, $user->getUID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue