fix(files): Also restore shares after ownership transfer for object storage
When a file is moved between different storages then the file id is not (always) preserved.
This means the file id has to be adjusted for all shares.
So in case the file id does not exist anymore we try to find the new file id based on the
target path of the transfer and the path suffix of the share.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Fix path handling when transferring incoming shares
When transferring incoming shares from a guest user without specifying a
path, the $path is empty.
The fix properly handles that situation to avoid looking for shares in a
path with doubled slashes which failed to find shares to transfer.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Init user's file system if not existing on ownership transfer
This makes it a bit easier to transfer ownership when the new user
hasn't already logged in. This still doesn't support encrypted
storages because the keys are not generated yet.
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Whenever a user was deleted but is still recipient of share entries,
delete these entries upon transfer.
Usually such entries would disappear after running cleanup background
jobs.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Added support for transfering incoming file shares.
- new option --transfer-incoming-shares=1 | 0
- new config.php option 'transfer-incoming-shares' => true | false
The command line option overrules the config.php option.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
E-mail shares weren't included in the processing of shares when using the `occ files:transfer-ownership` command, so they'd be lost (not visible in either the former or the new account). This commit fixes that.
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
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 makes the command more fault tolerant. An \Error can happen when
e.g. the owner of a share is null.
If we don't catch this, the restore process will stop in an unknown
state.
Signed-off-by: Tobia De Koninck <LEDfan@users.noreply.github.com>
This will move the home folder of own user to another user. Only allowed
if that other user's home folder is empty.
Can be used as workaround to rename users.
Signed-off-by: Tobia De Koninck <LEDfan@users.noreply.github.com>