diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 19b73be..65df31a 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -15,7 +15,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Drupal\comment\Plugin\Core\Entity\Comment; /** * Comment is awaiting approval. @@ -77,6 +76,8 @@ */ const COMMENT_NODE_OPEN = 2; +use Drupal\comment\Plugin\Core\Entity\Comment; + /** * Implements hook_help(). */ diff --git a/core/modules/comment/comment.routing.yml b/core/modules/comment/comment.routing.yml index a7b4fe2..be9de77 100644 --- a/core/modules/comment/comment.routing.yml +++ b/core/modules/comment/comment.routing.yml @@ -9,4 +9,5 @@ comment_permalink: defaults: _controller: '\Drupal\comment\Controller\CommentController::commentPermalink' requirements: - _access: 'TRUE' + _entity_access: 'comment.view' + diff --git a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php index 3265cfd..daa4234 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php @@ -7,9 +7,9 @@ namespace Drupal\comment\Controller; +use Drupal\comment\CommentInterface; use Drupal\Core\Controller\ControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\comment\Plugin\Core\Entity\Comment; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpFoundation\Request; @@ -57,15 +57,16 @@ public function __construct(HttpKernelInterface $httpKernel) { * * @param \Symfony\Component\HttpFoundation\Request $request * The request of the page. - * @param \Drupal\comment\Plugin\Core\Entity\Comment $comment + * @param \Drupal\comment\CommentInterface $comment * A comment entity. * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + * * @return \Symfony\Component\HttpFoundation\Response * The comment listing set to the page on which the comment appears. */ - public function commentPermalink(Request $request, Comment $comment) { + public function commentPermalink(Request $request, CommentInterface $comment) { if ($node = $comment->nid->entity) { // Check access permissions for the node entity. if (!$node->access('view')) {