Skip to content
Snippets Groups Projects
Commit f6ac34af authored by Florin Peter's avatar Florin Peter
Browse files

improved handling for getSharingUsersArray

parent 8790ceba
Branches
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ class Proxy extends \OC_FileProxy {
$sharingEnabled = \OCP\Share::isEnabled();
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $filePath );
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $filePath, $userId );
// Fetch public keys for all users who will share the file
$publicKeys = Keymanager::getPublicKeys( $rootView, $uniqueUserIds );
......
......@@ -335,12 +335,8 @@ class Stream {
$util = new Util( $this->rootView, $this->userId );
// Get all users sharing the file
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $this->relPath );
// allways add current user
$uniqueUserIds[] = $this->userId;
array_unique( $uniqueUserIds );
// Get all users sharing the file includes current user
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $this->relPath, $this->userId);
// Fetch public keys for all sharing users
$publicKeys = Keymanager::getPublicKeys( $this->rootView, $uniqueUserIds );
......
......@@ -848,7 +848,7 @@ class Util {
* @brief Find, sanitise and format users sharing a file
* @note This wraps other methods into a portable bundle
*/
public function getSharingUsersArray( $sharingEnabled, $filePath ) {
public function getSharingUsersArray( $sharingEnabled, $filePath, $currentUserId = false ) {
// Check if key recovery is enabled
$recoveryEnabled = $this->recoveryEnabled();
......@@ -879,6 +879,11 @@ class Util {
}
// add current user if given
if($currentUserId != false) {
$userIds[] = $currentUserId;
}
// Remove duplicate UIDs
$uniqueUserIds = array_unique ( $userIds );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment