diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-11 12:40:36 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-13 12:58:52 +0200 |
commit | 629b7c0fc38d9a2c33805bfcf4359e263e4ae68f (patch) | |
tree | 915d48dcfbc021fad3cbff2a5c53e7de006e630e /lib/private | |
parent | 6c23a5fa3511e5212c83e8407fa18b12ec975f97 (diff) | |
download | nextcloud-server-629b7c0fc38d9a2c33805bfcf4359e263e4ae68f.tar.gz nextcloud-server-629b7c0fc38d9a2c33805bfcf4359e263e4ae68f.zip |
Adjust docs and make !$currentAccess simpler
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Encryption/File.php | 4 | ||||
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 4 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 37 |
3 files changed, 33 insertions, 12 deletions
diff --git a/lib/private/Encryption/File.php b/lib/private/Encryption/File.php index f6fd3382cb5..2bc0e014f0c 100644 --- a/lib/private/Encryption/File.php +++ b/lib/private/Encryption/File.php @@ -95,14 +95,14 @@ class File implements \OCP\Encryption\IFile { $this->cache[$parent] = $resultForParents; } $userIds = array_merge($userIds, $resultForParents['users']); - $public = $resultForParents['public'] || !empty($resultForParents['remote']); + $public = $resultForParents['public'] || $resultForParents['remote']; // Find out who, if anyone, is sharing the file if ($file !== null) { $resultForFile = $this->shareManager->getAccessList($file, false); $userIds = array_merge($userIds, $resultForFile['users']); - $public = $resultForFile['public'] || !empty($resultForFile['remote']) || $public; + $public = $resultForFile['public'] || $resultForFile['remote'] || $public; } // check if it is a group mount diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index b28dc56f852..ed3651df9b2 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -1136,9 +1136,11 @@ class DefaultShareProvider implements IShareProvider { } $cursor->closeCursor(); - $users = array_map([$this, 'filterSharesOfUser'], $users); if ($currentAccess === true) { + $users = array_map([$this, 'filterSharesOfUser'], $users); $users = array_filter($users); + } else { + $users = array_keys($users); } return ['users' => $users, 'public' => $link]; diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 91fcb6af8fb..8b670da544b 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1181,18 +1181,33 @@ class Manager implements IManager { * * Consider: * -root - * |-folder1 - * |-folder2 - * |-fileA + * |-folder1 (23) + * |-folder2 (32) + * |-fileA (42) * - * fileA is shared with user1 + * fileA is shared with user1 and user1@server1 * folder2 is shared with group2 (user4 is a member of group2) - * folder1 is shared with user2 + * folder1 is shared with user2 (renamed to "folder (1)") and user2@server2 * - * Then the access list will to '/folder1/folder2/fileA' is: + * Then the access list to '/folder1/folder2/fileA' with $currentAccess is: * [ - * users => ['user1' => ['node_id' => 42, 'node_path' => '/path'], 'user2' => [...]], - * remote => ['user1' => ['node_id' => 42, 'node_path' => '/path'], 'user2' => [...]], + * users => [ + * 'user1' => ['node_id' => 42, 'node_path' => '/fileA'], + * 'user4' => ['node_id' => 32, 'node_path' => '/folder2'], + * 'user2' => ['node_id' => 23, 'node_path' => '/folder (1)'], + * ], + * remote => [ + * 'user1@server1' => ['node_id' => 42, 'token' => 'SeCr3t'], + * 'user2@server2' => ['node_id' => 23, 'token' => 'FooBaR'], + * ], + * public => bool + * mail => bool + * ] + * + * The access list to '/folder1/folder2/fileA' **without** $currentAccess is: + * [ + * users => ['user1', 'user2', 'user4'], + * remote => bool, * public => bool * mail => bool * ] @@ -1207,7 +1222,11 @@ class Manager implements IManager { public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false) { $owner = $path->getOwner()->getUID(); - $al = ['users' => [], 'remote' => [], 'public' => false]; + if ($currentAccess) { + $al = ['users' => [], 'remote' => [], 'public' => false]; + } else { + $al = ['users' => [], 'remote' => false, 'public' => false]; + } if (!$this->userManager->userExists($owner)) { return $al; } |