コード例 #1
0
ファイル: UserStorage.php プロジェクト: facilis/users
 public function getIdentity()
 {
     $identity = parent::getIdentity();
     if ($identity !== null && $identity->getId() == 'Facilis\\Users\\UserAggregate' && $identity instanceof Identity) {
         $identity = $this->entityManager->getRepository('Facilis\\Users\\UserAggregate')->find($identity->getData()['id']);
     }
     return $identity;
 }
コード例 #2
0
ファイル: UserStorage.php プロジェクト: instante/doctrine
 function __construct(ObjectRepository $userRepository, Session $sessionHandler)
 {
     parent::__construct($sessionHandler);
     $identity = parent::getIdentity();
     if ($identity !== NULL) {
         $identity = $userRepository->find($identity->getId());
     }
     $this->identity = $identity;
 }
コード例 #3
0
 /**
  * Returns current user identity, if any.
  * @return IIdentity|NULL
  */
 public function getIdentity()
 {
     $identity = parent::getIdentity();
     // if we have our fake identity, we now want to
     // convert it back into the real entity
     // returning reference provides potentially lazy behavior
     if ($identity instanceof FakeIdentity) {
         return $this->entityManager->getReference($identity->getClass(), $identity->getId());
     }
     return $identity;
 }
コード例 #4
0
ファイル: UserStorage.php プロジェクト: peterzadori/movi
 /**
  * @return Identity|Nette\Security\IIdentity|NULL
  * @throws InvalidStateException
  */
 public function getIdentity()
 {
     $identity = parent::getIdentity();
     if ($this->users === NULL) {
         throw new InvalidStateException('Service IUsers is not registered.');
     }
     if ($identity instanceof Identity && !$identity->isLoaded()) {
         $this->users->loadIdentity($identity);
     }
     return $identity;
 }
コード例 #5
0
ファイル: UserStorage.php プロジェクト: joseki/sandbox
 /**
  * Returns current user identity, if any.
  * @return User|NULL
  */
 public function getIdentity()
 {
     if ($this->identity) {
         return $this->identity;
     }
     $identity = parent::getIdentity();
     if ($identity instanceof FakeIdentity) {
         $this->identity = $this->userRepository->get($identity->getId());
         return $this->identity;
     }
     return $identity;
 }
コード例 #6
0
ファイル: UserStorage.php プロジェクト: svobodni/web
 public function getIdentity()
 {
     $identity = parent::getIdentity();
     if (!$identity instanceof Identity) {
         return $identity;
     }
     if (!$this->checkConnection->invoke()) {
         return NULL;
     }
     if (!isset($this->identities[$identity->id])) {
         $this->identities[$identity->id] = $this->userRepository->findOneBy(array('id' => $identity->id, 'published' => 1));
     }
     return $this->identities[$identity->id];
 }
コード例 #7
0
ファイル: UserStorage.php プロジェクト: blitzik/CMS
 /**
  * Returns current user identity, if any.
  * @return IIdentity|NULL
  */
 public function getIdentity()
 {
     $identity = parent::getIdentity();
     // if we have our fake identity, we now want to
     // convert it back into the real entity
     if ($identity instanceof FakeIdentity) {
         return $this->cache->load(sprintf('user-%s', $identity->getId()), function () use($identity) {
             return $this->entityManager->createQuery('SELECT u, roles FROM ' . $identity->getClass() . ' u
                  LEFT JOIN u.roles roles
                  WHERE u.id = :id')->setParameter('id', $identity->getId())->getOneOrNullResult();
         });
         //return $this->entityManager->getReference($identity->getClass(), $identity->getId());
     }
     return $identity;
 }