/** * {@inheritDoc} */ public function addVote(VoteInterface $vote, VotableCommentInterface $comment) { if (!$this->voteAcl->canCreate()) { throw new AccessDeniedException(); } if (!$this->commentAcl->canView($comment)) { throw new AccessDeniedException(); } $this->realManager->addVote($vote, $comment); }
/** * {@inheritDoc} */ public function saveVote(VoteInterface $vote) { if (!$this->voteAcl->canCreate()) { throw new AccessDeniedException(); } if (!$this->commentAcl->canView($vote->getComment())) { throw new AccessDeniedException(); } $this->realManager->saveVote($vote); $this->voteAcl->setDefaultAcl($vote); }
/** * Iterates over a comment tree array and makes sure all comments * have appropriate view permissions. * * @param array $comments A comment tree * * @return boolean */ protected function authorizeViewCommentTree(array $comments) { foreach ($comments as $comment) { if (!$this->commentAcl->canView($comment['comment'])) { return false; } if (is_array($comment['children'])) { return $this->authorizeViewCommentTree($comment['children']); } } return true; }