Skip to content

Commit 026553f

Browse files
committed
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 <roeland@famdouma.nl>
1 parent 606fcae commit 026553f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

apps/files/lib/Service/OwnershipTransferService.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function transfer(IUser $sourceUser,
8080
IUser $destinationUser,
8181
string $path,
8282
?OutputInterface $output = null,
83-
bool $move = false): void {
83+
bool $move = false,
84+
bool $firstLogin = false): void {
8485
$output = $output ?? new NullOutput();
8586
$sourceUid = $sourceUser->getUID();
8687
$destinationUid = $destinationUser->getUID();
@@ -107,7 +108,13 @@ public function transfer(IUser $sourceUser,
107108
throw new TransferOwnershipException("Unknown path provided: $path", 1);
108109
}
109110

110-
if ($move && (!$view->is_dir($finalTarget) || count($view->getDirectoryContent($finalTarget)) > 0)) {
111+
if ($move && (
112+
!$view->is_dir($finalTarget) || (
113+
!$firstLogin &&
114+
count($view->getDirectoryContent($finalTarget)) > 0
115+
)
116+
)
117+
) {
111118
throw new TransferOwnershipException("Destination path does not exists or is not empty", 1);
112119
}
113120

0 commit comments

Comments
 (0)