aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-11-14 07:41:41 +0100
committerprovokateurin <kate@provokateurin.de>2024-11-25 10:27:31 +0100
commit715e7143f042f537ecbc2fcfd936e1996dec1ade (patch)
tree15ac55ed82e82dffe9e2a74797cd79fc89634c56 /apps/files_sharing
parentc2ca99e2f641396b6823c1e675afd3ecb486e744 (diff)
downloadnextcloud-server-715e7143f042f537ecbc2fcfd936e1996dec1ade.tar.gz
nextcloud-server-715e7143f042f537ecbc2fcfd936e1996dec1ade.zip
fix(files_sharing,files): Do not validate shares before adjusting the owner
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Updater.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/Updater.php b/apps/files_sharing/lib/Updater.php
index 82075fb9ba5..226cf3e7fd4 100644
--- a/apps/files_sharing/lib/Updater.php
+++ b/apps/files_sharing/lib/Updater.php
@@ -50,10 +50,14 @@ class Updater {
$shareManager = \OC::$server->getShareManager();
+ // We intentionally include invalid shares, as they have been automatically invalidated due to the node no longer
+ // being accessible for the user. Only in this case where we adjust the share after it was moved we want to ignore
+ // this to be able to still adjust it.
+
// FIXME: should CIRCLES be included here ??
- $shares = $shareManager->getSharesBy($user->getUID(), IShare::TYPE_USER, $src, false, -1);
- $shares = array_merge($shares, $shareManager->getSharesBy($user->getUID(), IShare::TYPE_GROUP, $src, false, -1));
- $shares = array_merge($shares, $shareManager->getSharesBy($user->getUID(), IShare::TYPE_ROOM, $src, false, -1));
+ $shares = $shareManager->getSharesBy($user->getUID(), IShare::TYPE_USER, $src, false, -1, onlyValid: false);
+ $shares = array_merge($shares, $shareManager->getSharesBy($user->getUID(), IShare::TYPE_GROUP, $src, false, -1, onlyValid: false));
+ $shares = array_merge($shares, $shareManager->getSharesBy($user->getUID(), IShare::TYPE_ROOM, $src, false, -1, onlyValid: false));
if ($src instanceof Folder) {
$cacheAccess = Server::get(FileAccess::class);
@@ -61,9 +65,9 @@ class Updater {
$sourceStorageId = $src->getStorage()->getCache()->getNumericStorageId();
$sourceInternalPath = $src->getInternalPath();
$subShares = array_merge(
- $shareManager->getSharesBy($user->getUID(), IShare::TYPE_USER),
- $shareManager->getSharesBy($user->getUID(), IShare::TYPE_GROUP),
- $shareManager->getSharesBy($user->getUID(), IShare::TYPE_ROOM),
+ $shareManager->getSharesBy($user->getUID(), IShare::TYPE_USER, onlyValid: false),
+ $shareManager->getSharesBy($user->getUID(), IShare::TYPE_GROUP, onlyValid: false),
+ $shareManager->getSharesBy($user->getUID(), IShare::TYPE_ROOM, onlyValid: false),
);
$shareSourceIds = array_map(fn (IShare $share) => $share->getNodeId(), $subShares);
$shareSources = $cacheAccess->getByFileIdsInStorage($shareSourceIds, $sourceStorageId);
@@ -111,7 +115,7 @@ class Updater {
$share->setShareOwner($newOwner);
$share->setPermissions($newPermissions);
- $shareManager->updateShare($share);
+ $shareManager->updateShare($share, onlyValid: false);
}
}