diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 5463e26ed..a8abe3dc9 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -33,6 +33,7 @@ use OCA\Deck\Db\CardMapper; use OCA\Deck\Middleware\ExceptionMiddleware; use OCA\Deck\Notification\Notifier; use OCA\Deck\Service\FullTextSearchService; +use OCA\Deck\Service\PermissionService; use OCP\AppFramework\App; use OCP\Collaboration\Resources\IManager; use OCP\Comments\CommentsEntityEvent; @@ -156,13 +157,14 @@ class Application extends App { $this->getContainer()->getServer()->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { $event->addEntityCollection('deckCard', function($name) { /** @var CardMapper */ - $service = $this->getContainer()->query(CardMapper::class); + $cardMapper = $this->getContainer()->query(CardMapper::class); + $permissionService = $this->getContainer()->query(PermissionService::class); + try { - $service->find((int) $name); - } catch (\InvalidArgumentException $e) { + return $permissionService->checkPermission($cardMapper, (int) $name, Acl::PERMISSION_READ); + } catch (\Exception $e) { return false; } - return true; }); }); $this->registerCommentsEventHandler();