Don't get me wrong, I like the LDAP authentication concept that was given in http://osticket.com/forums/showthread.php?t=13731(http://osticket.com/forums/showthread.php?t=13731)... But I just don't need all of that for my version of osticket.
This version ONLY lets your staff log in with their AD credentials.
*NOTE* when you set them up in osticket - make sure their username matches their AD username
I kept it basic like I had it in 1.6 - with a few add-ons to make it work in this version:
Steps (all in class.staff.php):
1. In function load - search for:
$this->id = $this->ht;
2. directly below it - paste the following:
$this->username = $this->ht;
3. Find function check_passwd
4. past the following directly above it:
function check_ldap_passwd($password)
{
$ds=ldap_connect('ldap://your.domain') or die("Couldn't connect to AD!");
if ($ds) {
// use your AD domain below
$domain="Domain";
$ldapbind = ldap_bind($ds);
if (!@ldap_bind( $ds, $domain."\\".$this->username, $password) ) return $this->check_passwd($password);
else return true;
}
else return $this->check_passwd($password);
}
5. Find:
if(($user=new StaffSession(trim($username))) && $user->getId() && $user->check_passwd($passwd))
in function_login
6. Change the above line to:
if(($user=new StaffSession(trim($username))) && $user->getId() && $user->check_ldap_passwd($passwd))
That's it, hope someone enjoys :)... I've also attached a copy if you haven't already modified your own file - make sure to update it with your ad info
[class.staff.zip](https://forum.osticket.com/assets/files/migrated/1/c47c75fa5ef84c0d7bc924a12437f4e.zip)