Some renaming.
[timetracker.git] / WEB-INF / lib / auth / Auth_ldap.class.php
index 25d375b..3710167 100644 (file)
@@ -51,7 +51,7 @@
 class Auth_ldap extends Auth {
   var $params;
 
-  function Auth_ldap($params)
+  function __construct($params)
   {
     $this->params = $params;
     if (isset($GLOBALS['smarty'])) {
@@ -78,6 +78,13 @@ class Auth_ldap extends Auth {
    */
   function authenticate($login, $password)
   {
+    // Special handling for admin@localhost - authenticate against db, not ldap.
+    // It is a fallback mechanism when admin account in LDAP directory does not exist or is misconfigured.
+    if ($login == 'admin@localhost') {
+        import('auth.Auth_db');
+        return Auth_db::authenticate($login, $password);
+    }
+
     if (!function_exists('ldap_bind')) {
       die ('php_ldap extension not loaded!');
     }
@@ -255,7 +262,7 @@ class Auth_ldap extends Auth {
 
         if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
           echo '$member_of'; var_dump($member_of); echo '<br />';
-        };
+        }
 
         // check for group membership
         foreach ($member_of as $check_grp) {