Thursday, April 1, 2010

Implement LDAP facility in OrangeHRM

Hi all this article is about enabling LDAP authentication procedure in OrangeHRM so it has been considered from my side that you must have the knowlwdge about Orange HRM system.

If you are not aware of OHRM, then please go to www.orangehrm.com

I have implemented this facility using adLDAP which is nothing but a PHP class that provides LDAP authentication and integration with Active Directory. Another thing that I have installed OrangeHRM on win XP.

Please follow below steps to achieve LDAP implementation

  1. Download adLDAP from adLDAP Download
  2. Extract the zip containing adLDAP PHP class and place the adLDAP.php to OrangeHRM root directory as web_content(PHP root)/OrangeHRM/lib/common/ldap/adLDAP.php (create ldap directory as it is not present there)
  3. Now before start coding, please read the documentation of adLDAP at adLDAP Documentation because adLDAP class needs some information related to your ADS server to get connected
  4. Find login.php of OrangeHRM in which modification will be done
  5. Comment the existing code to handle LDAP module
  6. Below that write following piece of code
    require_once(dirname(__FILE__) . '/lib/common/ldap/adLDAP.php');
    $adldap = new adLDAP();
    $ldapFile = ROOT_PATH . "/lib/common/ldap/adLDAP.php";
    $_SESSION['ldap'] = "enabled";
    $_SESSION['ldapStatus'] = "enabled";
  7. Now call the adLDAP class's method authenticate() using adLDAP object in place of ldapAuth() as shown at the place of authentication code
    $ldapAuth = $adldap->authenticate($rset[0][0], $_POST['txtPassword']);
  8. Create the users in OrangeHRM same as ADS server with blank passwords
  9. Now start login with ADS authentication credentials
Please follow How to enable LDAP to get information about OrangeHRM LDAP module work

Hey as above has done with OrangeHRM using adLDAP, both are opensource projects developed using PHP. In my case it has been worked successfully. As I have also searched for this issue drastically but didn't got any solution so after achieved the solution me presenting this piece of work to you. Please let me know your reviews and comments if any...


Thanks