$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 );
$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
* @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();
$userIds[] = $adminUid;
}
-
+
+ // add current user if given
+ if($currentUserId != false) {
+ $userIds[] = $currentUserId;
+ }
+
// Remove duplicate UIDs
$uniqueUserIds = array_unique ( $userIds );