diff --git a/src/Model/Table/LdapConnectionsTable.php b/src/Model/Table/LdapConnectionsTable.php index 2ff14d5..8005d69 100755 --- a/src/Model/Table/LdapConnectionsTable.php +++ b/src/Model/Table/LdapConnectionsTable.php @@ -187,23 +187,24 @@ class LdapConnectionsTable extends AppTable } // $userName = login - public function getUserAttributes($userName, $LDAP_ANONYMOUS=true, $filter='', $just_these=[]) + public function getUserAttributes($userName, $ldapConnection, $LDAP_ANONYMOUS=true, $filter='', $just_these=[]) { try { + /* if ($this->checkConfiguration()) { if ($this->USE_LDAP) { $ldapConnection = ldap_connect($this->host, $this->port); ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); $results = ldap_search($ldapConnection, $this->baseDn, '(' . $this->authenticationType . '=' . $userName . ')'); return ldap_get_entries($ldapConnection, $results); - /* + */ if ($this->checkConfiguration()) { if ($this->USE_LDAP) { - /// + /* $ldapConnection = ldap_connect($this->host, $this->port); ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); - /// + */ // CRAL //$results = ldap_search($ldapConnection, $this->baseDn, $filter); if ($LDAP_ANONYMOUS) @@ -213,7 +214,6 @@ class LdapConnectionsTable extends AppTable $info = ldap_get_entries($ldapConnection, $results); //echo $info["count"]." entries returned\n"; return $info; - */ } else return array( $this->getFakeLdapUser($userName) @@ -335,20 +335,15 @@ class LdapConnectionsTable extends AppTable { try { if ($this->checkConfiguration()) { - + /* if ($this->USE_LDAP) { if (strlen(trim($password)) == 0) return FALSE; $ldapConnection = ldap_connect($this->host, $this->port); ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); if (@ldap_bind($ldapConnection, $this->authenticationType . '=' . $user_login . ',' . $this->baseDn, $user_password)) { return $this->getUserAttributes($user_login)[0]; - /* - * } else { - * return false; - */ } - - /* + */ // We are using LDAP if ($this->USE_LDAP) { $LDAP_ANONYMOUS = true; @@ -389,15 +384,15 @@ class LdapConnectionsTable extends AppTable $ldapbind = ldap_bind($ldapConnection, $binddn, $ldappass) or die( "Could not bind to LDAP server.". ldap_error($ldapConnection) ); if ($ldapbind) { //return $this->getUserAttributes($login, $LDAP_ANONYMOUS, $filter, $just_these)[0]; - $search = $this->getUserAttributes($user_login, $LDAP_ANONYMOUS, $filter, $just_these) or die("Could not search in LDAP server, response was: " . ldap_error($ldapConnection) ); + $search = $this->getUserAttributes($user_login, $ldapConnection, $LDAP_ANONYMOUS, $filter, $just_these); + if ($search === false) die("Could not get user attributes from LDAP server, response was: " . ldap_error($ldapConnection) ); return $search[0]; - /// + /* * } else { * return false; - /// + */ } } - */ // We are not using LDAP (use FAKE LDAP instead) } else { diff --git a/src/Template/Layout/default.ctp b/src/Template/Layout/default.ctp index 6b00e28..dc60d3c 100755 --- a/src/Template/Layout/default.ctp +++ b/src/Template/Layout/default.ctp @@ -119,7 +119,7 @@ $cakeDescription = 'Labinvent 2'; - VERSION 2.9.1.0 (14/12/2018)
VERSION 2.9.1.1 (14/12/2018)