/** * Authorizes the current user in the given channel. * * @param WiseChatChannel $channel * @param string $password * * @return boolean */ public function authorize($channel, $password) { if ($channel->getPassword() === md5($password)) { $this->authorization->markAuthorizedForChannel($channel); return true; } else { return false; } }
/** * @param WiseChatChannel $channel * @throws WiseChatUnauthorizedAccessException */ private function checkChannelAuthorization($channel) { if ($channel !== null && strlen($channel->getPassword()) > 0 && !$this->authorization->isUserAuthorizedForChannel($channel)) { throw new WiseChatUnauthorizedAccessException('Not authorized in this channel'); } }