findUserByIdentifier() 공개 메소드

Finds a user for a given email or username.
public findUserByIdentifier ( string $identifier ) : Sulu\Component\Security\Authentication\UserInterface
$identifier string The email-address or username
리턴 Sulu\Component\Security\Authentication\UserInterface
예제 #1
0
파일: UserProvider.php 프로젝트: sulu/sulu
 /**
  * {@inheritdoc}
  */
 public function loadUserByUsername($username)
 {
     $exceptionMessage = sprintf('Unable to find an Sulu\\Component\\Security\\Authentication\\UserInterface object identified by %s', $username);
     try {
         $user = $this->userRepository->findUserByIdentifier($username);
         if (!$user->getEnabled()) {
             throw new DisabledException();
         }
         if ($user->getLocked()) {
             throw new LockedException();
         }
         foreach ($user->getRoleObjects() as $role) {
             if ($role->getSystem() === $this->getSystem()) {
                 return $user;
             }
         }
     } catch (NoResultException $e) {
         throw new UsernameNotFoundException($exceptionMessage, 0, $e);
     }
     throw new UsernameNotFoundException($exceptionMessage, 0);
 }