public static function factory($username = NULL) { $user = new LDAP_User_Model(); if (NULL !== $username) { $user->get($username); } return $user; }
public function has_member($user) { // user model if ($user instanceof LDAP_User_Model) { return in_array($user->dn, $this->groupinfo['member']); } // dn if (in_array($user, $this->groupinfo['member'])) { return TRUE; } // display name foreach ($this->groupinfo['member'] as $value) { if (preg_match("/^CN={$user}/", $value) > 0) { return TRUE; } } // samaccountname $ldap_user = new LDAP_User_Model(); $ldap_user->get($user); if ($this->has_member($ldap_user)) { return TRUE; } return FALSE; }