]> source.dussan.org Git - nextcloud-server.git/commitdiff
Allow specifying this is the first login 19279/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Fri, 31 Jan 2020 10:04:43 +0000 (11:04 +0100)
committerBackportbot <backportbot-noreply@rullzer.com>
Mon, 3 Feb 2020 15:00:03 +0000 (15:00 +0000)
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 <roeland@famdouma.nl>
apps/files/lib/Service/OwnershipTransferService.php

index b130910e25b31ad6d24c760ecabef46f52fcb037..f316216814fda38befddc20a4c3e79d61e64f177 100644 (file)
@@ -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);
                }