Skip to content

Commit e14d2e9

Browse files
authored
Merge pull request #5542 from nextcloud/fix/catch-getBoard-exceptions
fix(PermissionService#getPermissions): Catch exceptions from getBoard method
2 parents 74cf8d8 + a45ede0 commit e14d2e9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/Service/PermissionService.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ public function getPermissions($boardId, ?string $userId = null) {
108108
return $cached;
109109
}
110110

111-
$board = $this->getBoard($boardId);
112-
$owner = $this->userIsBoardOwner($boardId, $userId);
113-
$acls = $board->getDeletedAt() === 0 ? $this->aclMapper->findAll($boardId) : [];
111+
try {
112+
$board = $this->getBoard($boardId);
113+
$owner = $this->userIsBoardOwner($boardId, $userId);
114+
$acls = $board->getDeletedAt() === 0 ? $this->aclMapper->findAll($boardId) : [];
115+
} catch (MultipleObjectsReturnedException|DoesNotExistException $e) {
116+
$owner = false;
117+
$acls = [];
118+
}
119+
114120
$permissions = [
115121
Acl::PERMISSION_READ => $owner || $this->userCan($acls, Acl::PERMISSION_READ, $userId),
116122
Acl::PERMISSION_EDIT => $owner || $this->userCan($acls, Acl::PERMISSION_EDIT, $userId),

0 commit comments

Comments
 (0)