aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Sabre/TrashRoot.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/Sabre/TrashRoot.php')
-rw-r--r--apps/files_trashbin/lib/Sabre/TrashRoot.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/files_trashbin/lib/Sabre/TrashRoot.php b/apps/files_trashbin/lib/Sabre/TrashRoot.php
index ff2ea3aaa02..dd89583d9a1 100644
--- a/apps/files_trashbin/lib/Sabre/TrashRoot.php
+++ b/apps/files_trashbin/lib/Sabre/TrashRoot.php
@@ -8,8 +8,10 @@ declare(strict_types=1);
*/
namespace OCA\Files_Trashbin\Sabre;
+use OCA\Files_Trashbin\Service\ConfigService;
use OCA\Files_Trashbin\Trash\ITrashItem;
use OCA\Files_Trashbin\Trash\ITrashManager;
+use OCA\Files_Trashbin\Trashbin;
use OCP\Files\FileInfo;
use OCP\IUser;
use Sabre\DAV\Exception\Forbidden;
@@ -18,19 +20,18 @@ use Sabre\DAV\ICollection;
class TrashRoot implements ICollection {
- /** @var IUser */
- private $user;
-
- /** @var ITrashManager */
- private $trashManager;
-
- public function __construct(IUser $user, ITrashManager $trashManager) {
- $this->user = $user;
- $this->trashManager = $trashManager;
+ public function __construct(
+ private IUser $user,
+ private ITrashManager $trashManager,
+ ) {
}
public function delete() {
- \OCA\Files_Trashbin\Trashbin::deleteAll();
+ if (!ConfigService::getDeleteFromTrashEnabled()) {
+ throw new Forbidden('Not allowed to delete items from the trash bin');
+ }
+
+ Trashbin::deleteAll();
foreach ($this->trashManager->listTrashRoot($this->user) as $trashItem) {
$this->trashManager->removeItem($trashItem);
}