summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-31 18:09:46 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-05-05 12:05:36 +0200
commit4e1d57e81500b6d5e63d3a8d05bd92f274b2185a (patch)
tree9af942cf401a635b6fa0d25efe3d73df6649e70b /apps/files_encryption
parent76cdd85cd990bd51de564512e2f5c8e6351dd660 (diff)
downloadnextcloud-server-4e1d57e81500b6d5e63d3a8d05bd92f274b2185a.tar.gz
nextcloud-server-4e1d57e81500b6d5e63d3a8d05bd92f274b2185a.zip
always encrypt files to owner
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/stream.php2
-rw-r--r--apps/files_encryption/lib/util.php17
2 files changed, 9 insertions, 10 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index b3fa71f5f59..9039d504d41 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 de6bfef91d0..5c538ae7db1 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();