Skip to content

Commit

Permalink
fix(PermissionService#getPermissions): Catch exceptions from getBoard…
Browse files Browse the repository at this point in the history
… method

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr authored and backportbot[bot] committed Feb 2, 2024
1 parent e2c2824 commit 5eb3e65
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/Service/PermissionService.php
Expand Up @@ -108,9 +108,15 @@ public function getPermissions($boardId, ?string $userId = null) {
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),
Expand Down

0 comments on commit 5eb3e65

Please sign in to comment.