From fb52038e7ceadac9477244a27e4d458dfbbbb6a4 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 1 Aug 2023 09:39:58 -0700 Subject: [PATCH] applies a check if a sync field is designated --- app/Console/Commands/LdapSync.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index f77f5f8c48..3b497a45b0 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -234,17 +234,37 @@ class LdapSync extends Command $item['createorupdate'] = 'created'; } - $user->first_name = $item['firstname']; - $user->last_name = $item['lastname']; + //If a sync option is not filled in on the LDAP settings don't populate the user field + if($ldap_result_username != null){ $user->username = $item['username']; - $user->email = $item['email']; + } + if($ldap_result_last_name != null){ + $user->last_name = $item['lastname']; + } + if($ldap_result_first_name != null){ + $user->first_name = $item['firstname']; + } + if($ldap_result_active_flag != null){ + } + if($ldap_result_emp_num != null){ $user->employee_num = e($item['employee_number']); + } + if($ldap_result_email != null){ + $user->email = $item['email']; + } + if($ldap_result_phone != null){ $user->phone = $item['telephone']; + } + if($ldap_result_jobtitle != null){ $user->jobtitle = $item['jobtitle']; + } + if($ldap_result_country != null){ $user->country = $item['country']; + } + if($ldap_result_dept != null){ $user->department_id = $department->id; - $user->location_id = $location->id; - + } + if($ldap_result_manager != null){ if($item['manager'] != null) { // Check Cache first if (isset($manager_cache[$item['manager']])) { @@ -284,6 +304,7 @@ class LdapSync extends Command } } + } // Sync activated state for Active Directory. if ( !empty($ldap_result_active_flag)) { // IF we have an 'active' flag set....