Beispiel #1
0
 /**
  * Get the last logon time of any user as a Unix timestamp
  * 
  * @param string $username
  * @return long $unixTimestamp
  */
 public function getLastLogon($username)
 {
     if (!$this->adldap->getLdapBind()) {
         return false;
     }
     if ($username === null) {
         return "Missing compulsory field [username]";
     }
     $userInfo = $this->info($username, array("lastLogonTimestamp"));
     $lastLogon = adLDAPUtils::convertWindowsTimeToUnixTime($userInfo[0]['lastLogonTimestamp'][0]);
     return $lastLogon;
 }
Beispiel #2
0
 /**
  * Create a Search-String useable by adLDAPUsers::all($includeDescription = false, $search = "*", $sorted = true)
  *
  * @param array $filter
  * @return string
  */
 protected function _constructSearchString($filter)
 {
     if (!$filter) {
         return '*';
     }
     $adldapUtils = new adLDAPUtils($this->_adldap(null));
     $result = '*';
     if (isset($filter['name'])) {
         $result .= ')(displayname=*' . $adldapUtils->ldapSlashes($filter['name']) . '*';
         unset($filter['name']);
     }
     if (isset($filter['user'])) {
         $result .= ')(samAccountName=*' . $adldapUtils->ldapSlashes($filter['user']) . '*';
         unset($filter['user']);
     }
     if (isset($filter['mail'])) {
         $result .= ')(mail=*' . $adldapUtils->ldapSlashes($filter['mail']) . '*';
         unset($filter['mail']);
     }
     return $result;
 }