예제 #1
1
 /**
  * Updates a user entry in the database
  *
  * @param User $user
  * @return \Doctrine\DBAL\Driver\Statement|int
  */
 protected function updateUser(User $user)
 {
     return $this->query()->update('User')->where('username = ?')->setParameter(0, strtolower($user->getUsername()))->set('password', '?')->setParameter(1, $user->getPassword())->set('roles', '?')->setParameter(2, join(',', $user->getRoles()))->set('enabled', '?')->setParameter(3, $user->isEnabled())->set('expired', '?')->setParameter(4, !$user->isAccountNonExpired())->set('credentialsExpired', '?')->setParameter(5, !$user->isCredentialsNonExpired())->set('locked', '?')->setParameter(6, !$user->isAccountNonLocked())->execute();
 }
예제 #2
0
 public function testIsAccountNonLocked()
 {
     $user = new User('fabien', 'superpass');
     $this->assertTrue($user->isAccountNonLocked());
     $user = new User('fabien', 'superpass', array(), true, true, true, false);
     $this->assertFalse($user->isAccountNonLocked());
 }
 /**
  * {@inheritdoc}
  */
 public function loadUserByUsername($username)
 {
     if (isset($this->users[$username])) {
         $user = $this->users[$username];
     } else {
         $user = new User($username, '', array('ROLE_CONNECT_USER'), true, true, true, true);
     }
     return new User($user->getUsername(), $user->getPassword(), $user->getRoles(), $user->isEnabled(), $user->isAccountNonExpired(), $user->isCredentialsNonExpired(), $user->isAccountNonLocked());
 }