summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-31 18:09:46 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-31 18:19:48 +0200
commit8e34812393d730da9a161d1724eba818de61076c (patch)
tree60024329dfb39d3e8d01ff7350f78b35af5fa314
parent65e3f634000a2142f412b85d0443f241bb64a9ab (diff)
downloadnextcloud-server-8e34812393d730da9a161d1724eba818de61076c.tar.gz
nextcloud-server-8e34812393d730da9a161d1724eba818de61076c.zip
always encrypt files to owner
-rw-r--r--apps/files_encryption/lib/stream.php2
-rw-r--r--apps/files_encryption/lib/util.php16
-rw-r--r--lib/public/share.php6
3 files changed, 11 insertions, 13 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 58ac03373a7..66871945882 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 3db5a423478..4bf987d9255 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1124,8 +1124,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();
@@ -1144,12 +1145,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;
}
@@ -1165,11 +1168,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 a08134b3837..564839e86b6 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -63,9 +63,9 @@ class Share extends \OC\Share\Constants {
/**
* 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'