Commit 8b86699b196cab3329e3ec03263c4d0fc85a6f08
1 parent
ffc7fb21
Exists in
master
and in
2 other branches
test ldap
Showing
1 changed file
with
10 additions
and
5 deletions
Show diff stats
src/Model/Table/LdapConnectionsTable.php
@@ -13,7 +13,7 @@ class LdapConnectionsTable extends AppTable | @@ -13,7 +13,7 @@ class LdapConnectionsTable extends AppTable | ||
13 | // (EP 23/5/19) Optimisation: | 13 | // (EP 23/5/19) Optimisation: |
14 | // Les utilisateurs sont stockés dans un cache (BD) | 14 | // Les utilisateurs sont stockés dans un cache (BD) |
15 | // pour limiter les accès au LDAP | 15 | // pour limiter les accès au LDAP |
16 | - private $LDAP_CACHED = FALSE; | 16 | + private $LDAP_CACHED = TRUE; |
17 | 17 | ||
18 | public $useTable = false; | 18 | public $useTable = false; |
19 | 19 | ||
@@ -503,9 +503,12 @@ class LdapConnectionsTable extends AppTable | @@ -503,9 +503,12 @@ class LdapConnectionsTable extends AppTable | ||
503 | // TODO: optimisation possible | 503 | // TODO: optimisation possible |
504 | // 1) Search user in CACHE (DB) | 504 | // 1) Search user in CACHE (DB) |
505 | $user_fetched = $this->checkAndFetchLDAPUserFromDB($user_login, $user_password); | 505 | $user_fetched = $this->checkAndFetchLDAPUserFromDB($user_login, $user_password); |
506 | + $this->mydebugmsg("(1) user found in DB is:"); | ||
507 | + $this->mydebugmsg($user_fetched); | ||
508 | + //TODO: A VIRER !!! | ||
509 | + $user_fetched = FALSE; | ||
506 | // 2) If not CACHED, search user in LDAP | 510 | // 2) If not CACHED, search user in LDAP |
507 | if ($user_fetched === FALSE) { | 511 | if ($user_fetched === FALSE) { |
508 | - | ||
509 | //$user_fetched = $this->checkAndFetchUserFromLdap($user_login, $user_password); | 512 | //$user_fetched = $this->checkAndFetchUserFromLdap($user_login, $user_password); |
510 | 513 | ||
511 | $just_these = []; | 514 | $just_these = []; |
@@ -518,15 +521,17 @@ class LdapConnectionsTable extends AppTable | @@ -518,15 +521,17 @@ class LdapConnectionsTable extends AppTable | ||
518 | //TODO: optimisation, refactoriser si comportement général | 521 | //TODO: optimisation, refactoriser si comportement général |
519 | //$binddn .= ','.$this->baseDn; | 522 | //$binddn .= ','.$this->baseDn; |
520 | $user_fetched = $this->searchLdap($filter, $just_these, $user_login, $user_password); | 523 | $user_fetched = $this->searchLdap($filter, $just_these, $user_login, $user_password); |
524 | + $this->mydebugmsg("(1) user found in LDAP is:"); | ||
525 | + $this->mydebugmsg($user_fetched); | ||
521 | // CACHE the new user in DB for next time | 526 | // CACHE the new user in DB for next time |
522 | - if ($user_fetched != FALSE) { | 527 | + if ($user_fetched !== FALSE) { |
523 | $this->saveNewUserInDB($user_fetched[0]); | 528 | $this->saveNewUserInDB($user_fetched[0]); |
524 | return $user_fetched[0]; | 529 | return $user_fetched[0]; |
525 | } | 530 | } |
526 | } | 531 | } |
527 | else { | 532 | else { |
528 | - debug("user found in DB"); | ||
529 | - debug($user_fetched); | 533 | + $this->mydebugmsg("(2) user found in DB is:"); |
534 | + $this->mydebugmsg($user_fetched); | ||
530 | } | 535 | } |
531 | //return $user_fetched; // Noter que $user_fetched peut etre egal a FALSE (si pas trouvé) | 536 | //return $user_fetched; // Noter que $user_fetched peut etre egal a FALSE (si pas trouvé) |
532 | } | 537 | } |