]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix multiple users having the same external share mountpoint
authorRobin Appelman <icewind@owncloud.com>
Mon, 16 Jun 2014 13:57:01 +0000 (15:57 +0200)
committerRobin Appelman <icewind@owncloud.com>
Mon, 16 Jun 2014 13:57:01 +0000 (15:57 +0200)
apps/files_sharing/appinfo/database.xml
apps/files_sharing/appinfo/version
apps/files_sharing/lib/external/manager.php

index 159d6cb1c578e5ce232668400bdc8b838d2be614..73d64c527b7a381e6cd5144dcbf942d10fd79a0a 100644 (file)
                        <index>
                                <name>sh_external_mp</name>
                                <unique>true</unique>
+                               <field>
+                                       <name>user</name>
+                                       <sorting>ascending</sorting>
+                               </field>
                                <field>
                                        <name>mountpoint_hash</name>
                                        <sorting>ascending</sorting>
index 4b9fcbec101a6ff8ec68e0f95131ccda4861407f..cb0c939a936f142669d38cf1ece330266d730965 100644 (file)
@@ -1 +1 @@
-0.5.1
+0.5.2
index 381651f8c6a659c9353da87628ea721c354d8e09..70a0e98ebd57b54043f5bbba662d240d541f41e4 100644 (file)
@@ -117,22 +117,24 @@ class Manager {
         * @return bool
         */
        public function setMountPoint($source, $target) {
+               $user = $this->userSession->getUser();
                $source = $this->stripPath($source);
                $target = $this->stripPath($target);
                $sourceHash = md5($source);
                $targetHash = md5($target);
 
                $query = $this->connection->prepare('UPDATE *PREFIX*share_external SET
-                       `mountpoint` = ?, `mountpoint_hash` = ? WHERE `mountpoint_hash` = ?');
-               $result = (bool)$query->execute(array($target, $targetHash, $sourceHash));
+                       `mountpoint` = ?, `mountpoint_hash` = ? WHERE `mountpoint_hash` = ? AND `user` = ?');
+               $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $user->getUID()));
 
                return $result;
        }
 
        public function removeShare($mountPoint) {
+               $user = $this->userSession->getUser();
                $mountPoint = $this->stripPath($mountPoint);
                $hash = md5($mountPoint);
-               $query = $this->connection->prepare('DELETE FROM *PREFIX*share_external WHERE `mountpoint_hash` = ?');
-               return (bool)$query->execute(array($hash));
+               $query = $this->connection->prepare('DELETE FROM *PREFIX*share_external WHERE `mountpoint_hash` = ? AND `user` = ?');
+               return (bool)$query->execute(array($hash, $user->getUID()));
        }
 }