eZ\Publish\Core\MVC\Symfony\Security\User::isAccountNonExpired PHP Method

isAccountNonExpired() public method

Internally, if this method returns false, the authentication system will throw an AccountExpiredException and prevent login.
See also: AccountExpiredException
public isAccountNonExpired ( ) : boolean
return boolean true if the user's account is non expired, false otherwise
    public function isAccountNonExpired()
    {
        return $this->user->enabled;
    }

Usage Example

Esempio n. 1
0
 public function testConstruct()
 {
     $login = '******';
     $passwordHash = 'encoded_password';
     $apiUser = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\User\\User')->setConstructorArgs(array(array('login' => $login, 'passwordHash' => $passwordHash, 'enabled' => true)))->getMockForAbstractClass();
     $roles = array('ROLE_USER');
     $user = new User($apiUser, $roles);
     $this->assertSame($apiUser, $user->getAPIUser());
     $this->assertSame($login, $user->getUsername());
     $this->assertSame($passwordHash, $user->getPassword());
     $this->assertSame($roles, $user->getRoles());
     $this->assertNull($user->getSalt());
     $this->assertTrue($user->isAccountNonExpired());
     $this->assertTrue($user->isAccountNonLocked());
     $this->assertTrue($user->isCredentialsNonExpired());
     $this->assertTrue($user->isEnabled());
 }