Exemple #1
0
 public function testUtilityValidateLdapIsBoundFailure()
 {
     $adldap = $this->mock('Adldap\\Adldap');
     $adldap->shouldReceive('getLdapConnection')->andReturn(true)->shouldReceive('getLdapBind')->andReturn(false)->shouldReceive('close')->andReturn(true);
     $utility = new AdldapUtils($adldap);
     $this->setExpectedException('Adldap\\Exceptions\\AdldapException');
     $utility->validateLdapIsBound();
 }
 public function getLastLogon($username)
 {
     $this->adldap->utilities()->validateNotNull('Username', $username);
     $userInfo = $this->info($username, ['lastlogontimestamp']);
     if (is_array($userInfo) && array_key_exists('lastlogontimestamp', $userInfo)) {
         return AdldapUtils::convertWindowsTimeToUnixTime($userInfo['lastlogontimestamp']);
     }
     return false;
 }