Commit e72921bd799138a10de725af58775dc6fc46e307
1 parent
dc63cdde
Exists in
master
and in
2 other branches
(IRAP ONLY) LDAP refactorisation && optimisation (3)
- LdapConnectionsTable.php/getUserAttributes() simplification (ldap only, not used by fake ldap !!) - Nouveaux liens "What's New ?" et "Documentation technique" en bas de page web - LDAP refactor pour ajouter mode LDAP authentifié
Showing
1 changed file
with
18 additions
and
9 deletions
Show diff stats
src/Model/Table/LdapConnectionsTable.php
@@ -2,11 +2,17 @@ | @@ -2,11 +2,17 @@ | ||
2 | namespace App\Model\Table; | 2 | namespace App\Model\Table; |
3 | 3 | ||
4 | /* TODO LIST | 4 | /* TODO LIST |
5 | - * | 5 | + * |
6 | + | ||
7 | +DONE: | ||
6 | - 1) remplacer ldapAuthentication() par ldapAuthenticationNEW() | 8 | - 1) remplacer ldapAuthentication() par ldapAuthenticationNEW() |
7 | -- 2) virer getUserAttributes() à virer, remplacé par getLdap1UserOrAllUsersAttributes() | ||
8 | -- 3) getAllLdapUsersNEW() pour remplacer getAllLdapUsers() | 9 | + |
10 | +TODO: | ||
11 | +- 2) remplacer getUserAttributes() par getLdap1UserOrAllUsersAttributes() | ||
12 | +- 3) virer getLdap1UserOrAllUsersAttributes() et merger son code dans la seule fonction qui l'appelle : searchLdap() | ||
13 | +- 4) getAllLdapUsersNEW() pour remplacer getAllLdapUsers() | ||
9 | - TableRegistry::get() à remplacer par TableRegistry::getTableLocator()->get() | 14 | - TableRegistry::get() à remplacer par TableRegistry::getTableLocator()->get() |
15 | + | ||
10 | * | 16 | * |
11 | */ | 17 | */ |
12 | 18 | ||
@@ -303,7 +309,8 @@ class LdapConnectionsTable extends AppTable | @@ -303,7 +309,8 @@ class LdapConnectionsTable extends AppTable | ||
303 | 309 | ||
304 | 310 | ||
305 | 311 | ||
306 | - | 312 | + |
313 | + // REAL LDAP only | ||
307 | // TODO: avirer, VIEUX CODE, à remplacer par getLdap1UserOrAllUsersAttributes() | 314 | // TODO: avirer, VIEUX CODE, à remplacer par getLdap1UserOrAllUsersAttributes() |
308 | // $userName = login | 315 | // $userName = login |
309 | public function getUserAttributes($ldapConnection, $userName) | 316 | public function getUserAttributes($ldapConnection, $userName) |
@@ -311,15 +318,17 @@ class LdapConnectionsTable extends AppTable | @@ -311,15 +318,17 @@ class LdapConnectionsTable extends AppTable | ||
311 | try { | 318 | try { |
312 | 319 | ||
313 | if ($this->checkConfiguration()) { | 320 | if ($this->checkConfiguration()) { |
314 | - if ($this->LDAP_USED) { | ||
315 | - //$ldapConnection = ldap_connect($this->host, $this->port); | ||
316 | - //ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); | ||
317 | - $results = ldap_search($ldapConnection, $this->baseDn, '(' . $this->authenticationType . '=' . $userName . ')'); | ||
318 | - return ldap_get_entries($ldapConnection, $results); | 321 | + //if ($this->LDAP_USED) { |
322 | + //$ldapConnection = ldap_connect($this->host, $this->port); | ||
323 | + //ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); | ||
324 | + $results = ldap_search($ldapConnection, $this->baseDn, '(' . $this->authenticationType . '=' . $userName . ')'); | ||
325 | + return ldap_get_entries($ldapConnection, $results); | ||
326 | + /* | ||
319 | } else | 327 | } else |
320 | return array( | 328 | return array( |
321 | $this->getFakeLdapUser($userName) | 329 | $this->getFakeLdapUser($userName) |
322 | ); | 330 | ); |
331 | + */ | ||
323 | } | 332 | } |
324 | } catch (Exception $e) {} | 333 | } catch (Exception $e) {} |
325 | 334 |