fix(references): Mute NoPermissionException as it is expected to happen for references

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2023-03-06 21:58:20 +01:00
committed by backportbot-nextcloud[bot]
parent fb5aed2143
commit 3574abe0cb
3 changed files with 26 additions and 7 deletions

View File

@@ -23,6 +23,7 @@
namespace OCA\Deck\Reference;
use OCA\Deck\AppInfo\Application;
use OCA\Deck\NoPermissionException;
use OCA\Deck\Service\BoardService;
use OCP\Collaboration\Reference\IReference;
use OCP\Collaboration\Reference\IReferenceProvider;
@@ -67,7 +68,12 @@ class BoardReferenceProvider implements IReferenceProvider {
if ($this->matchReference($referenceText)) {
$boardId = $this->getBoardId($referenceText);
if ($boardId !== null) {
$board = $this->boardService->find($boardId)->jsonSerialize();
try {
$board = $this->boardService->find($boardId)->jsonSerialize();
} catch (NoPermissionException $e) {
// Skip throwing if user has no permissions
return null;
}
$board = $this->sanitizeSerializedBoard($board);
/** @var IReference $reference */
$reference = new Reference($referenceText);