From a82d72e5cee9445fd5bfe69b714c3b43dfc0ed8c Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 16 Mar 2021 17:35:17 +0100 Subject: [PATCH] Only perform login check during ownership transfer for encryption Signed-off-by: Christoph Wurst --- apps/files/lib/Service/OwnershipTransferService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index fa979c2006..66b3550b07 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -101,12 +101,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);