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>
This commit is contained in:
parent
c3092fda9a
commit
38735c2bd0
1 changed files with 9 additions and 2 deletions
|
@ -80,7 +80,8 @@ class OwnershipTransferService {
|
||||||
IUser $destinationUser,
|
IUser $destinationUser,
|
||||||
string $path,
|
string $path,
|
||||||
?OutputInterface $output = null,
|
?OutputInterface $output = null,
|
||||||
bool $move = false): void {
|
bool $move = false,
|
||||||
|
bool $firstLogin = false): void {
|
||||||
$output = $output ?? new NullOutput();
|
$output = $output ?? new NullOutput();
|
||||||
$sourceUid = $sourceUser->getUID();
|
$sourceUid = $sourceUser->getUID();
|
||||||
$destinationUid = $destinationUser->getUID();
|
$destinationUid = $destinationUser->getUID();
|
||||||
|
@ -107,7 +108,13 @@ class OwnershipTransferService {
|
||||||
throw new TransferOwnershipException("Unknown path provided: $path", 1);
|
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);
|
throw new TransferOwnershipException("Destination path does not exists or is not empty", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue