{@inheritDoc}
@see \Ness\Component\User\Loader\UserLoaderInterface::loadUser()
763563
public function loadUser(string $name): UserInterface
    {
        foreach ($this->loaders as $loader) {
            try {
                return $loader->loadUser($name);
            } catch (UserNotFoundException $e) {
                continue;
            }
        }
        
        throw new UserNotFoundException("This user '{$name}' cannot be loaded over registered loaders into UserLoaderCollection");
    }
665735
public function loadUserByUsername($username)
    {
        if (!$this->queryField || !$username) {
            return false;
        }

        $user = $this->documentModel->getRepository()->findOneBy(
            [
                $this->queryField => new \MongoRegex('/^'.preg_quote($username).'$/i')
            ]
        );

        return $user ? $user : false;
    }
270251
public function load($username): UserInterface
    {
        $grav = Grav::instance();
        /** @var UniformResourceLocator $locator */
        $locator = $grav['locator'];

        // force lowercase of username
        $username = mb_strtolower($username);

        $filename = 'account://' . $username . YAML_EXT;
        $path = $locator->findResource($filename) ?: $locator->findResource($filename, true, true);
        $file = CompiledYamlFile::instance($path);
        $content = (array)$file->content() + ['username' => $username, 'state' => 'enabled'];

        $userClass = $this->className;
        $callable = function() {
            $blueprints = new Blueprints;

            return $blueprints->get('user/account');
        };

        /** @var UserInterface $user */
        $user = new $userClass($content, $callable);
        $user->file($file);

        return $user;
    }
1320824
public function setUser($user)
    {
        if (\is_object($user)) {
            $this->userObject = $user;
            $this->user       = $user->getId();
        } else {
            $this->userObject = null;
            $this->user       = $user;
        }

        return $this;
    }
920943
protected function addUserIdentityToPayload(UserInterface $user, array &$payload)
    {
        $accessor                    = PropertyAccess::createPropertyAccessor();
        $payload[$this->userIdClaim ?: $this->userIdentityField] = $accessor->getValue($user, $this->userIdentityField);
    }
987186
public function load(LoaderInterface $loader, $merge = true)
    {
        $this->internalLoad($loader->load(), $merge);
    }
631242
public function loadUser(EventInterface $event) {
        $request = $event->getRequest();
        $response = $event->getResponse();
        $user = $request->getUser();
        $database = $event->getDatabase();

        $numImages = $database->getNumImages($user);
        $lastModified = $database->getLastModified([$user]);

        $userModel = new Model\User();
        $userModel->setUserId($user)
                  ->setNumImages($numImages)
                  ->setLastModified($lastModified);

        $response->setModel($userModel)
                 ->setLastModified($lastModified);
    }
119219
public function loadUserByUsername($username)
    {
        if (!isset($this->cachedUsers[$username])) {
            $this->cachedUsers[$username] = $this->userProvider->loadUserByUsername($username);
        }
        return $this->cachedUsers[$username];
    }
207776
public function getUser()
    {
        if (null === $token = $this->securityContext->getToken()) {
            return;
        }

        if (!is_object($user = $token->getUser())) {
            return;
        }

        return $user;
    }
413137
public function loadUser($userId)
    {
        $user = $this->userService->loadUser($userId, Language::ALL);

        $userContentInfo = $user->getVersionInfo()->getContentInfo();
        $contentType = $this->contentTypeService->loadContentType($userContentInfo->contentTypeId);

        try {
            $userMainLocation = $this->locationService->loadLocation($userContentInfo->mainLocationId);
            $relations = $this->contentService->loadRelations($user->getVersionInfo());
        } catch (UnauthorizedException $e) {
            // TODO: Hack for special case to allow current logged in user to load him/here self (but not relations)
            if ($user->id == $this->repository->getCurrentUser()->id) {
                $userMainLocation = $this->repository->sudo(
                    function () use ($userContentInfo) {
                        return $this->locationService->loadLocation($userContentInfo->mainLocationId);
                    }
                );
                // user may not have permissions to read related content, for security reasons do not use sudo().
                $relations = array();
            } else {
                throw $e;
            }
        }

        return new Values\CachedValue(
            new Values\RestUser(
                $user,
                $contentType,
                $userContentInfo,
                $userMainLocation,
                $relations
            ),
            array('locationId' => $userContentInfo->mainLocationId)
        );
    }
351921
protected function loadUserThrottles(UserInterface $user)
    {
        $interval = Carbon::now()
            ->subSeconds($this->userInterval);

        return $this
            ->createModel()
            ->newQuery()
            ->where('type', 'user')
            ->where('user_id', $user->getUserId())
            ->where('created_at', '>', $interval)
            ->get();
    }
983338
protected function getLoader(): LoaderInterface
    {
        if (! $this->loader instanceof LoaderInterface) {
            $this->loader = new CacheLoader(sprintf(
                '%s/%s.php',
                rtrim($this->getCacheLocation(), '/'),
                $this->getCacheFilename()
            ));
        }

        return $this->loader;
    }
1059224
public function getLoader(): LoaderInterface
    {
        if (!isset($this->i__loader)) {
            $this->i__loader = new DelegateLoader();
        }

        return $this->i__loader;
    }
736358
protected function getUser()
    {
        if ($this->_user === null) {
            $this->_user = User::findByUsername($this->username);
        }

        return $this->_user;
    }
565630
protected function loadAPIUser(SyliusUserInterface $user)
    {
        $eZSyliusUser = $this->eZUserRepository->findOneBy(
            array(
                'syliusUserId' => $user->getId(),
                'syliusUserType' => $this->syliusUserType,
            )
        );

        if (!$eZSyliusUser instanceof EzSyliusUser) {
            return null;
        }

        try {
            return $this->repository->getUserService()->loadUser(
                $eZSyliusUser->getEzUserId()
            );
        } catch (NotFoundException $e) {
            return null;
        }
    }
423217
public function loadUserPayPalUser()
    {
        $result = false;
        if (($userId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("oepaypal-userId"))) {
            $result = $this->load($userId);
        }

        return $result;
    }
458525
public function loadUserByUsername($username)
    {
        if (!($username && $this->configSource->has('auth-password/' . $username))) {
            throw new UsernameNotFoundException();
        }

        $userData = $this->configSource->get('auth-password/' . $username);

        return new UserInformation(array_merge($userData, ['username' => $username]));
    }