[Pkg-owncloud-commits] [owncloud] 161/223: Fix multiple users having the same external share mountpoint

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 0616eb4007b14d701ca3949c83bddf0a31507b56
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Jun 16 15:57:01 2014 +0200

    Fix multiple users having the same external share mountpoint
---
 apps/files_sharing/appinfo/database.xml     |  4 ++++
 apps/files_sharing/appinfo/version          |  2 +-
 apps/files_sharing/lib/external/manager.php | 10 ++++++----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/apps/files_sharing/appinfo/database.xml b/apps/files_sharing/appinfo/database.xml
index 159d6cb..73d64c5 100644
--- a/apps/files_sharing/appinfo/database.xml
+++ b/apps/files_sharing/appinfo/database.xml
@@ -82,6 +82,10 @@
 				<name>sh_external_mp</name>
 				<unique>true</unique>
 				<field>
+					<name>user</name>
+					<sorting>ascending</sorting>
+				</field>
+				<field>
 					<name>mountpoint_hash</name>
 					<sorting>ascending</sorting>
 				</field>
diff --git a/apps/files_sharing/appinfo/version b/apps/files_sharing/appinfo/version
index 4b9fcbe..cb0c939 100644
--- a/apps/files_sharing/appinfo/version
+++ b/apps/files_sharing/appinfo/version
@@ -1 +1 @@
-0.5.1
+0.5.2
diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php
index 381651f..70a0e98 100644
--- a/apps/files_sharing/lib/external/manager.php
+++ b/apps/files_sharing/lib/external/manager.php
@@ -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()));
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list