From 5eb3e65c5470b9dde0985f9334a213ddd0ed9ca1 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 2 Feb 2024 11:50:17 +0100 Subject: [PATCH] fix(PermissionService#getPermissions): Catch exceptions from getBoard method Signed-off-by: Marcel Klehr --- lib/Service/PermissionService.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index e573c0257..4a83cdb47 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -108,9 +108,15 @@ class PermissionService { return $cached; } - $board = $this->getBoard($boardId); - $owner = $this->userIsBoardOwner($boardId, $userId); - $acls = $board->getDeletedAt() === 0 ? $this->aclMapper->findAll($boardId) : []; + try { + $board = $this->getBoard($boardId); + $owner = $this->userIsBoardOwner($boardId, $userId); + $acls = $board->getDeletedAt() === 0 ? $this->aclMapper->findAll($boardId) : []; + } catch (MultipleObjectsReturnedException|DoesNotExistException $e) { + $owner = false; + $acls = []; + } + $permissions = [ Acl::PERMISSION_READ => $owner || $this->userCan($acls, Acl::PERMISSION_READ, $userId), Acl::PERMISSION_EDIT => $owner || $this->userCan($acls, Acl::PERMISSION_EDIT, $userId),