From: Roeland Jago Douma Date: Fri, 31 Jan 2020 10:04:43 +0000 (+0100) Subject: Allow specifying this is the first login X-Git-Tag: v18.0.1RC1~11^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=38735c2bd08496dddcc104c23b5945105a4a5a13;p=nextcloud-server.git Allow specifying this is the first login On firstlogin we allow non empty target folders. So that for guest transfers the user sees the same UI. Signed-off-by: Roeland Jago Douma --- diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index b130910e25b..f316216814f 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -80,7 +80,8 @@ class OwnershipTransferService { IUser $destinationUser, string $path, ?OutputInterface $output = null, - bool $move = false): void { + bool $move = false, + bool $firstLogin = false): void { $output = $output ?? new NullOutput(); $sourceUid = $sourceUser->getUID(); $destinationUid = $destinationUser->getUID(); @@ -107,7 +108,13 @@ class OwnershipTransferService { throw new TransferOwnershipException("Unknown path provided: $path", 1); } - if ($move && (!$view->is_dir($finalTarget) || count($view->getDirectoryContent($finalTarget)) > 0)) { + if ($move && ( + !$view->is_dir($finalTarget) || ( + !$firstLogin && + count($view->getDirectoryContent($finalTarget)) > 0 + ) + ) + ) { throw new TransferOwnershipException("Destination path does not exists or is not empty", 1); }