improved handling for getSharingUsersArray
This commit is contained in:
parent
8790ceba25
commit
f6ac34afea
|
@ -134,7 +134,7 @@ class Proxy extends \OC_FileProxy {
|
||||||
|
|
||||||
$sharingEnabled = \OCP\Share::isEnabled();
|
$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
|
// Fetch public keys for all users who will share the file
|
||||||
$publicKeys = Keymanager::getPublicKeys( $rootView, $uniqueUserIds );
|
$publicKeys = Keymanager::getPublicKeys( $rootView, $uniqueUserIds );
|
||||||
|
|
|
@ -335,14 +335,10 @@ class Stream {
|
||||||
|
|
||||||
$util = new Util( $this->rootView, $this->userId );
|
$util = new Util( $this->rootView, $this->userId );
|
||||||
|
|
||||||
// Get all users sharing the file
|
// Get all users sharing the file includes current user
|
||||||
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $this->relPath );
|
$uniqueUserIds = $util->getSharingUsersArray( $sharingEnabled, $this->relPath, $this->userId);
|
||||||
|
|
||||||
// allways add current user
|
// Fetch public keys for all sharing users
|
||||||
$uniqueUserIds[] = $this->userId;
|
|
||||||
array_unique( $uniqueUserIds );
|
|
||||||
|
|
||||||
// Fetch public keys for all sharing users
|
|
||||||
$publicKeys = Keymanager::getPublicKeys( $this->rootView, $uniqueUserIds );
|
$publicKeys = Keymanager::getPublicKeys( $this->rootView, $uniqueUserIds );
|
||||||
|
|
||||||
// Encrypt enc key for all sharing users
|
// Encrypt enc key for all sharing users
|
||||||
|
|
|
@ -848,7 +848,7 @@ class Util {
|
||||||
* @brief Find, sanitise and format users sharing a file
|
* @brief Find, sanitise and format users sharing a file
|
||||||
* @note This wraps other methods into a portable bundle
|
* @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
|
// Check if key recovery is enabled
|
||||||
$recoveryEnabled = $this->recoveryEnabled();
|
$recoveryEnabled = $this->recoveryEnabled();
|
||||||
|
@ -879,6 +879,11 @@ class Util {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add current user if given
|
||||||
|
if($currentUserId != false) {
|
||||||
|
$userIds[] = $currentUserId;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove duplicate UIDs
|
// Remove duplicate UIDs
|
||||||
$uniqueUserIds = array_unique ( $userIds );
|
$uniqueUserIds = array_unique ( $userIds );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue