Example #1
0
 public function isAuthenticated()
 {
     if (($ret = parent::isAuthenticated()) === FALSE) {
         return FALSE;
     }
     if (($identity = $this->getIdentity()) === NULL) {
         return FALSE;
     }
     if ($identity instanceof UserEntity) {
         if (!isset($this->logins[$this->session->id][$identity->id])) {
             $this->logins[$this->session->id][$identity->id] = (bool) $this->loginRepository->findOneBy(array('user' => $identity->id, 'sessionId' => $this->session->id));
         }
         return $this->logins[$this->session->id][$identity->id];
     } else {
         if ($this->checkConnection->invoke()) {
             try {
                 if (!isset($this->logins[$this->session->id][-1])) {
                     $this->logins[$this->session->id][-1] = (bool) $this->loginRepository->findOneBy(array('user' => NULL, 'sessionId' => $this->session->id));
                     if (!$this->logins[$this->session->id][-1]) {
                         $this->setAuthenticated(TRUE);
                     }
                 }
                 return TRUE;
             } catch (DBALException $e) {
             }
         }
     }
     return $ret;
 }