Avoid blocking calendar access if something goes wrong while fetching deck entries

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-12-29 15:57:35 +01:00
parent 66fa241382
commit bfc8222e6f
2 changed files with 14 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Db\Stack;
use OCA\Deck\Db\StackMapper;
use OCA\Deck\NoPermissionException;
use OCA\Deck\StatusException;
class StackService {
@@ -142,7 +143,12 @@ class StackService {
}
public function findCalendarEntries($boardId) {
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
try {
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
} catch (NoPermissionException $e) {
\OC::$server->getLogger()->error('Unable to check permission for a previously obtained board ' . $boardId, ['exception' => $e]);
return [];
}
return $this->stackMapper->findAll($boardId);
}