improved handling for getSharingUsersArray
This commit is contained in:
parent
8790ceba25
commit
f6ac34afea
3 changed files with 11 additions and 10 deletions
|
@ -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,14 +335,10 @@ class Stream {
|
|||
|
||||
$util = new Util( $this->rootView, $this->userId );
|
||||
|
||||
// Get all users sharing the file
|
||||
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $this->relPath );
|
||||
// Get all users sharing the file includes current user
|
||||
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $this->relPath, $this->userId);
|
||||
|
||||
// allways add current user
|
||||
$uniqueUserIds[] = $this->userId;
|
||||
array_unique( $uniqueUserIds );
|
||||
|
||||
// Fetch public keys for all sharing users
|
||||
// Fetch public keys for all sharing users
|
||||
$publicKeys = Keymanager::getPublicKeys( $this->rootView, $uniqueUserIds );
|
||||
|
||||
// Encrypt enc key for all sharing users
|
||||
|
|
|
@ -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();
|
||||
|
@ -878,7 +878,12 @@ class Util {
|
|||
$userIds[] = $adminUid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// add current user if given
|
||||
if($currentUserId != false) {
|
||||
$userIds[] = $currentUserId;
|
||||
}
|
||||
|
||||
// Remove duplicate UIDs
|
||||
$uniqueUserIds = array_unique ( $userIds );
|
||||
|
||||
|
|
Loading…
Reference in a new issue