From beea8854cac3544792fc13514b5b194b875b44e6 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 15 Oct 2024 11:08:21 +0200 Subject: feat(files_sharing): Allow users with share permission to manage shares on IShareOwnerlessMount Signed-off-by: provokateurin --- apps/files_sharing/lib/Controller/ShareAPIController.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'apps/files_sharing/lib') diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 2ef4cb77726..ff20a0acf3c 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -35,6 +35,7 @@ use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; +use OCP\Files\Mount\IShareOwnerlessMount; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\HintException; @@ -1541,6 +1542,12 @@ class ShareAPIController extends OCSController { return true; } + $userFolder = $this->rootFolder->getUserFolder($this->userId); + $file = $userFolder->getFirstNodeById($share->getNodeId()); + if ($file?->getMountPoint() instanceof IShareOwnerlessMount && $this->shareProviderResharingRights($this->userId, $share, $file)) { + return true; + } + //! we do NOT support some kind of `admin` in groups. //! You cannot edit shares shared to a group you're //! a member of if you're not the share owner or the file owner! @@ -1576,6 +1583,12 @@ class ShareAPIController extends OCSController { return true; } + $userFolder = $this->rootFolder->getUserFolder($this->userId); + $file = $userFolder->getFirstNodeById($share->getNodeId()); + if ($file?->getMountPoint() instanceof IShareOwnerlessMount && $this->shareProviderResharingRights($this->userId, $share, $file)) { + return true; + } + return false; } -- cgit v1.2.3