/** * Tells if the current user is allowed to see the thread * * @param ThreadInterface $thread * * @return boolean */ public function canSeeThread(ThreadInterface $thread) { $currentParticipant = $this->participantProvider->getAuthenticatedParticipant(); if (!$currentParticipant) { return false; } return null !== $thread->getParticipantMetadata($currentParticipant); }
/** * Tells if the current user can reply to this thread * * @param ThreadInterface $thread * @return bool */ public function canReply(ThreadInterface $thread) { if (!array_key_exists('can_reply_' . $thread->getId(), $this->cache)) { $this->cache['can_reply_' . $thread->getId()] = $this->authorizer->canReplyToThread($thread); } return $this->cache['can_reply_' . $thread->getId()]; }