コード例 #1
0
ファイル: WiseChatService.php プロジェクト: andyUA/kabmin-new
 /**
  * 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');
     }
 }