From b8ef6dfba4a5aabd80ae121fa40bbb67b88614b1 Mon Sep 17 00:00:00 2001 From: Aladin Alaily Date: Sat, 15 Aug 2015 00:16:29 -0400 Subject: [PATCH 1/3] Wrote more information about an optional field --- app/config/production/ldap.example.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/config/production/ldap.example.php b/app/config/production/ldap.example.php index 071561b9ae..5442823891 100644 --- a/app/config/production/ldap.example.php +++ b/app/config/production/ldap.example.php @@ -75,6 +75,12 @@ return array( 'result.last.name' => "", 'result.first.name' => "", 'result.email' => "", + + /* + | This field is optional as not all LDAP directories will have it. If yours + | does not have it, just leave this field blank and the extra check will + | be omitted. + */ 'result.active.flag' => "", /* From 3dfbd8a4f053acea9a665cc3381fb2e7e54fa5d2 Mon Sep 17 00:00:00 2001 From: Aladin Alaily Date: Sat, 15 Aug 2015 00:27:56 -0400 Subject: [PATCH 2/3] Added a check for the "active" LDAP flag. Since this field is optional, it's important to check whether or not it's set, otherwise, the functionality will be unusable. --- app/controllers/admin/UsersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/UsersController.php b/app/controllers/admin/UsersController.php index b1fddeedb3..a9888da7b2 100755 --- a/app/controllers/admin/UsersController.php +++ b/app/controllers/admin/UsersController.php @@ -1112,7 +1112,7 @@ class UsersController extends AdminController { $summary = array(); for ($i = 0; $i < $results["count"]; $i++) { - if ($results[$i][$ldap_result_active_flag][0] == "TRUE") { + if (empty($ldap_result_active_flag) || $results[$i][$ldap_result_active_flag][0] == "TRUE") { $item = array(); $item["username"] = isset( $results[$i][$ldap_result_username][0] ) ? $results[$i][$ldap_result_username][0] : ""; From 23bde136658b1032a421713792a6e8885396240d Mon Sep 17 00:00:00 2001 From: Aladin Alaily Date: Sat, 15 Aug 2015 00:29:38 -0400 Subject: [PATCH 3/3] Corrected a typo and remove some testing code --- app/controllers/admin/UsersController.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/UsersController.php b/app/controllers/admin/UsersController.php index a9888da7b2..0db83a931b 100755 --- a/app/controllers/admin/UsersController.php +++ b/app/controllers/admin/UsersController.php @@ -1068,7 +1068,7 @@ class UsersController extends AdminController { /** * LDAP form processing. * - * @Auther Aldin Alaily + * @author Aldin Alaily * @return Redirect */ public function postLDAP() { @@ -1166,11 +1166,7 @@ class UsersController extends AdminController { array_push($summary, $item); } - /* Easy break in the loop */ - /* - if ($i >= 1) - break; - */ + }