]> source.dussan.org Git - nextcloud-server.git/commitdiff
Only perform login check during ownership transfer for encryption 26149/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Tue, 16 Mar 2021 16:35:17 +0000 (17:35 +0100)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Fri, 19 Mar 2021 10:25:56 +0000 (11:25 +0100)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
apps/files/lib/Service/OwnershipTransferService.php

index 870aa9f9d77c09171fc80c3ec306a223b3bbd7c2..3ab1a0c29d55d43d1c7d4f9884a841315d4b0654 100644 (file)
@@ -100,12 +100,15 @@ class OwnershipTransferService {
                $destinationUid = $destinationUser->getUID();
                $sourcePath = rtrim($sourceUid . '/files/' . $path, '/');
 
-               // target user has to be ready
-               if ($destinationUser->getLastLogin() === 0 || !$this->encryptionManager->isReadyForUser($destinationUid)) {
+               // If encryption is on we have to ensure the user has logged in before and that all encryption modules are ready
+               if (($this->encryptionManager->isEnabled() && $destinationUser->getLastLogin() === 0)
+                       || !$this->encryptionManager->isReadyForUser($destinationUid)) {
                        throw new TransferOwnershipException("The target user is not ready to accept files. The user has at least to have logged in once.", 2);
                }
 
                // setup filesystem
+               // Requesting the user folder will set it up if the user hasn't logged in before
+               \OC::$server->getUserFolder($destinationUser->getUID());
                Filesystem::initMountPoints($sourceUid);
                Filesystem::initMountPoints($destinationUid);