aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephan Orbaugh <62374139+sorbaugh@users.noreply.github.com>2024-03-20 09:06:21 +0100
committerGitHub <noreply@github.com>2024-03-20 09:06:21 +0100
commit6fa89c85b04232a25cc28ac12899129f2b0e85dc (patch)
tree77069fd2cd158c70dbf82baf6394ab6569ee1232 /lib
parentc34e252252e045983e73959c29a8ec79bc07eaaf (diff)
parentbf71bd1305cff875d79f92d473746670423de150 (diff)
downloadnextcloud-server-6fa89c85b04232a25cc28ac12899129f2b0e85dc.tar.gz
nextcloud-server-6fa89c85b04232a25cc28ac12899129f2b0e85dc.zip
Merge pull request #44339 from nextcloud/fix/noid/use-share-owner
fix(share): use share owner to get ownership
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/Manager.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 9b54592dd1e..af124ca8bc9 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -210,7 +210,7 @@ class Manager implements IManager {
*
* @suppress PhanUndeclaredClassMethod
*/
- protected function generalCreateChecks(IShare $share) {
+ protected function generalCreateChecks(IShare $share, bool $isUpdate = false) {
if ($share->getShareType() === IShare::TYPE_USER) {
// We expect a valid user as sharedWith for user shares
if (!$this->userManager->userExists($share->getSharedWith())) {
@@ -296,8 +296,14 @@ class Manager implements IManager {
$isFederatedShare = $share->getNode()->getStorage()->instanceOfStorage('\OCA\Files_Sharing\External\Storage');
$permissions = 0;
+
+ $isReshare = $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy();
+ if (!$isReshare && $isUpdate) {
+ // in case of update on owner-less filesystem, we use share owner to improve reshare detection
+ $isReshare = $share->getShareOwner() !== $share->getSharedBy();
+ }
- if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {
+ if (!$isFederatedShare && $isReshare) {
$userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function ($mount) {
// We need to filter since there might be other mountpoints that contain the file
// e.g. if the user has access to the same external storage that the file is originating from
@@ -999,7 +1005,7 @@ class Manager implements IManager {
throw new \InvalidArgumentException('Cannot share with the share owner');
}
- $this->generalCreateChecks($share);
+ $this->generalCreateChecks($share, true);
if ($share->getShareType() === IShare::TYPE_USER) {
$this->userCreateChecks($share);