From e72921bd799138a10de725af58775dc6fc46e307 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Fri, 22 Feb 2019 15:34:47 +0100 Subject: [PATCH] (IRAP ONLY) LDAP refactorisation && optimisation (3) --- src/Model/Table/LdapConnectionsTable.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Model/Table/LdapConnectionsTable.php b/src/Model/Table/LdapConnectionsTable.php index 2ea4fc6..476916d 100755 --- a/src/Model/Table/LdapConnectionsTable.php +++ b/src/Model/Table/LdapConnectionsTable.php @@ -2,11 +2,17 @@ namespace App\Model\Table; /* TODO LIST - * + * + +DONE: - 1) remplacer ldapAuthentication() par ldapAuthenticationNEW() -- 2) virer getUserAttributes() à virer, remplacé par getLdap1UserOrAllUsersAttributes() -- 3) getAllLdapUsersNEW() pour remplacer getAllLdapUsers() + +TODO: +- 2) remplacer getUserAttributes() par getLdap1UserOrAllUsersAttributes() +- 3) virer getLdap1UserOrAllUsersAttributes() et merger son code dans la seule fonction qui l'appelle : searchLdap() +- 4) getAllLdapUsersNEW() pour remplacer getAllLdapUsers() - TableRegistry::get() à remplacer par TableRegistry::getTableLocator()->get() + * */ @@ -303,7 +309,8 @@ class LdapConnectionsTable extends AppTable - + + // REAL LDAP only // TODO: avirer, VIEUX CODE, à remplacer par getLdap1UserOrAllUsersAttributes() // $userName = login public function getUserAttributes($ldapConnection, $userName) @@ -311,15 +318,17 @@ class LdapConnectionsTable extends AppTable try { if ($this->checkConfiguration()) { - if ($this->LDAP_USED) { - //$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->LDAP_USED) { + //$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); + /* } else return array( $this->getFakeLdapUser($userName) ); + */ } } catch (Exception $e) {} -- libgit2 0.21.2