[Pkg-owncloud-commits] [owncloud] 03/85: always encrypt files to owner

David Prévot taffit at moszumanska.debian.org
Tue Jun 17 19:12:39 UTC 2014


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

taffit pushed a commit to branch 6.0
in repository owncloud.

commit 4e1d57e81500b6d5e63d3a8d05bd92f274b2185a
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Mon Mar 31 18:09:46 2014 +0200

    always encrypt files to owner
---
 apps/files_encryption/lib/stream.php |  2 +-
 apps/files_encryption/lib/util.php   | 17 ++++++++---------
 lib/public/share.php                 |  6 +++---
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index b3fa71f..9039d50 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -545,7 +545,7 @@ class Stream {
 				$util = new Util($this->rootView, $this->userId);
 
 				// Get all users sharing the file includes current user
-				$uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $this->userId);
+				$uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath);
 				$checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds);
 
 				// Fetch public keys for all sharing users
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index de6bfef..5c538ae 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1164,8 +1164,10 @@ class Util {
 	/**
 	 * @brief Find, sanitise and format users sharing a file
 	 * @note This wraps other methods into a portable bundle
+	 * @param boolean $sharingEnabled
+	 * @param string $filePath path relativ to current users files folder
 	 */
-	public function getSharingUsersArray($sharingEnabled, $filePath, $currentUserId = false) {
+	public function getSharingUsersArray($sharingEnabled, $filePath) {
 
 		// Check if key recovery is enabled
 		if (
@@ -1182,12 +1184,14 @@ class Util {
 
 		$ownerPath = \OCA\Encryption\Helper::stripPartialFileExtension($ownerPath);
 
-		$userIds = array();
+		// always add owner to the list of users with access to the file
+		$userIds = array($owner);
+
 		if ($sharingEnabled) {
 
 			// Find out who, if anyone, is sharing the file
-			$result = \OCP\Share::getUsersSharingFile($ownerPath, $owner, true);
-			$userIds = $result['users'];
+			$result = \OCP\Share::getUsersSharingFile($ownerPath, $owner);
+			$userIds = \array_merge($userIds, $result['users']);
 			if ($result['public']) {
 				$userIds[] = $this->publicShareKeyId;
 			}
@@ -1203,11 +1207,6 @@ class Util {
 			$userIds[] = $recoveryKeyId;
 		}
 
-		// add current user if given
-		if ($currentUserId !== false) {
-			$userIds[] = $currentUserId;
-		}
-
 		// check if it is a group mount
 		if (\OCP\App::isEnabled("files_external")) {
 			$mount = \OC_Mount_Config::getSystemMountPoints();
diff --git a/lib/public/share.php b/lib/public/share.php
index c7e893b..7dd0d09 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -135,9 +135,9 @@ class Share {
 
 	/**
 	 * Find which users can access a shared item
-	 * @param $path to the file
-	 * @param $user owner of the file
-	 * @param include owner to the list of users with access to the file
+	 * @param string $path to the file
+	 * @param string $user owner of the file
+	 * @param bool $includeOwner include owner to the list of users with access to the file
 	 * @return array
 	 * @note $path needs to be relative to user data dir, e.g. 'file.txt'
 	 *       not '/admin/data/file.txt'

-- 
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