Only perform login check during ownership transfer for encryption

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2021-03-16 17:35:17 +01:00
parent 7bf5adb1fa
commit e68c4a4ed3
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 5 additions and 2 deletions

View 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);