From 4a2804dae28bf0206d015f2a16db8c35e72687bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Thu, 15 Apr 2021 12:51:03 +0200 Subject: [PATCH] Drop share if moved to a parent share that does not allow resharing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_sharing/lib/Updater.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_sharing/lib/Updater.php b/apps/files_sharing/lib/Updater.php index e035ed51ec8..19ff13d8950 100644 --- a/apps/files_sharing/lib/Updater.php +++ b/apps/files_sharing/lib/Updater.php @@ -26,6 +26,7 @@ */ namespace OCA\Files_Sharing; +use OCP\Constants; use OCP\Share\IShare; class Updater { @@ -81,6 +82,10 @@ class Updater { //Ownership is moved over foreach ($shares as $share) { /** @var IShare $share */ + if (!($dstMount->getShare()->getPermissions() & Constants::PERMISSION_SHARE)) { + $shareManager->deleteShare($share); + continue; + } $share->setShareOwner($newOwner); $shareManager->updateShare($share); } -- 2.39.5