예제 #1
0
 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
 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
 /**
  * @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
 /**
  * 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
 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;
 }