/** * @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; }