fix(PermissionService#getPermissions): Catch exceptions from getBoard method

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2024-02-02 11:50:17 +01:00 коммит произвёл backportbot[bot]
Родитель a302b554c8
Коммит 357397a2dd
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -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),