From 13d3f85c62074219a7401843c7a83cbbcb4ded45 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 1 Nov 2023 12:26:58 -0700 Subject: [PATCH 1/2] fixes ldap location sync --- app/Console/Commands/LdapSync.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index afe1070dd0..edb29614ee 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -83,7 +83,12 @@ class LdapSync extends Command $summary = []; try { - if ($this->option('base_dn') != '') { + if ( $this->option('location_id') != '') { + $location_ou= Location::where('id', '=', $this->option('location_id'))->value('ldap_ou'); + $search_base = $location_ou; + Log::debug('Importing users from specified location OU: \"'.$search_base.'\".'); + } + else if ($this->option('base_dn') != '') { $search_base = $this->option('base_dn'); Log::debug('Importing users from specified base DN: \"'.$search_base.'\".'); } else { From 4d65d0930637d32f8fbb2d76e957645b9c6cc34d Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2023 14:50:40 +0000 Subject: [PATCH 2/2] Removed trim on manager ID Signed-off-by: snipe --- app/Importer/UserImporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Importer/UserImporter.php b/app/Importer/UserImporter.php index 7e23708e78..040f34f9ef 100644 --- a/app/Importer/UserImporter.php +++ b/app/Importer/UserImporter.php @@ -61,7 +61,7 @@ class UserImporter extends ItemImporter $this->item['activated'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'activated'))) == 1) ? '1' : 0; $this->item['employee_num'] = trim($this->findCsvMatch($row, 'employee_num')); $this->item['department_id'] = trim($this->createOrFetchDepartment(trim($this->findCsvMatch($row, 'department')))); - $this->item['manager_id'] = $this->fetchManager(trim($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name'))); + $this->item['manager_id'] = $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name')); $this->item['remote'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'remote'))) == 1 ) ? '1' : 0; $this->item['vip'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'vip'))) ==1 ) ? '1' : 0; $this->item['autoassign_licenses'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'autoassign_licenses'))) ==1 ) ? '1' : 0;