Пример #1
0
 /**
  * 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;
     }
 }
Пример #2
0
 /**
  * @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');
     }
 }