Skip to content

A free open source IT asset/license management system

applies a check if a sync field is designated

Godfrey Mfb52038e7cea
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....