summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-04-02 13:20:51 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-04-02 13:20:51 +0200
commit1782dcbb5075748e5d0fc3babda4b94567f900b9 (patch)
treeef2de810e9f80ddaf9e7bdac8837d02675ad63a2 /apps
parentc0746f6b49dd4b4ea59ad9bb866989c1edfb5502 (diff)
parent8e34812393d730da9a161d1724eba818de61076c (diff)
downloadnextcloud-server-1782dcbb5075748e5d0fc3babda4b94567f900b9.tar.gz
nextcloud-server-1782dcbb5075748e5d0fc3babda4b94567f900b9.zip
Merge pull request #7977 from owncloud/fix_enc_if_sharing_is_disabled
always encrypt files to owner
Diffstat (limited to 'apps')
-rw-r--r--apps/files_encryption/lib/stream.php2
-rw-r--r--apps/files_encryption/lib/util.php16
2 files changed, 8 insertions, 10 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 1a163db887c..df5de558867 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 c3058aefa6f..b86815021a8 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1127,8 +1127,9 @@ 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) {
$appConfig = \OC::$server->getAppConfig();
@@ -1147,12 +1148,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;
}
@@ -1168,11 +1171,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();