/** * {@inheritDoc} */ public function findAllThreads() { $threads = $this->realManager->findAllThreads(); foreach ($threads as $thread) { if (!$this->threadAcl->canView($thread)) { throw new AccessDeniedException(); } } return $threads; }
/** * {@inheritDoc} */ public function addComment(CommentInterface $comment, CommentInterface $parent = null) { if (!$this->threadAcl->canView($comment->getThread())) { throw new AccessDeniedException(); } if (!$this->commentAcl->canReply($parent)) { throw new AccessDeniedException(); } $this->realManager->addComment($comment, $parent); $this->commentAcl->setDefaultAcl($comment); }
/** * {@inheritDoc} */ public function saveComment(CommentInterface $comment) { if (!$this->threadAcl->canView($comment->getThread())) { throw new AccessDeniedException(); } if (!$this->commentAcl->canReply($comment->getParent())) { throw new AccessDeniedException(); } $newComment = $this->isNewComment($comment); if (!$newComment && !$this->commentAcl->canEdit($comment)) { throw new AccessDeniedException(); } if (($comment::STATE_DELETED === $comment->getState() || $comment::STATE_DELETED === $comment->getPreviousState()) && !$this->commentAcl->canDelete($comment)) { throw new AccessDeniedException(); } $this->realManager->saveComment($comment); if ($newComment) { $this->commentAcl->setDefaultAcl($comment); } }