From 68783f3581144c1c2a7ccd644a89406f1c8dfc68 Mon Sep 17 00:00:00 2001 From: "Bernd.Rederlechner@t-systems.com" Date: Wed, 30 Aug 2023 16:44:05 +0200 Subject: [PATCH 1/2] Add the root lock blocker for stable25, upstream standard with stable26 --- lib/Controller/LockingController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Controller/LockingController.php b/lib/Controller/LockingController.php index 830d1f34..7cee27b1 100644 --- a/lib/Controller/LockingController.php +++ b/lib/Controller/LockingController.php @@ -90,6 +90,12 @@ public function lockFolder(int $id): DataResponse { throw new OCSForbiddenException($this->l10n->t('You are not allowed to create the lock')); } + if ($userFolder->getId() === $id) { + $e = new OCSForbiddenException($this->l10n->t('You are not allowed to lock the root')); + $this->logger->error($e->getMessage(), ['exception' => $e]); + throw $e; + } + $nodes = $userFolder->getById($id); if (!isset($nodes[0]) || !$nodes[0] instanceof Folder) { throw new OCSForbiddenException($this->l10n->t('You are not allowed to create the lock')); From bc78b5f22ff1b4540e1b63135f4e7ec5d93210a4 Mon Sep 17 00:00:00 2001 From: "Bernd.Rederlechner@t-systems.com" Date: Wed, 30 Aug 2023 17:10:03 +0200 Subject: [PATCH 2/2] Remove logging --- lib/Controller/LockingController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Controller/LockingController.php b/lib/Controller/LockingController.php index 7cee27b1..2722e7dc 100644 --- a/lib/Controller/LockingController.php +++ b/lib/Controller/LockingController.php @@ -91,9 +91,7 @@ public function lockFolder(int $id): DataResponse { } if ($userFolder->getId() === $id) { - $e = new OCSForbiddenException($this->l10n->t('You are not allowed to lock the root')); - $this->logger->error($e->getMessage(), ['exception' => $e]); - throw $e; + throw new OCSForbiddenException($this->l10n->t('You are not allowed to lock the root')); } $nodes = $userFolder->getById($id);