diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index ece83ae1e..d478f1143 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -2994,6 +2994,7 @@ class LdapAdvanced $this->arrayUserUpdateChecked[$username] = 1; $arrayUserDataUpdate = []; + $extendedData = []; foreach ($arrayAttributesToSync as $key => $value) { $fieldName = $key; @@ -3015,12 +3016,24 @@ class LdapAdvanced break; } - if ($ldapAttributeValue != $arrayUser[$username][$fieldName]) { - $arrayUserDataUpdate[$fieldName] = $ldapAttributeValue; + if (isset($arrayUser[$username][$fieldName])) { + if ($ldapAttributeValue != $arrayUser[$username][$fieldName]) { + $arrayUserDataUpdate[$fieldName] = $ldapAttributeValue; + } + } else { + $extendedData[$fieldName] = $ldapAttributeValue; } } } + //update the extended data + if (!empty($extendedData)) { + $json = $arrayUser[$username]['USR_EXTENDED_ATTRIBUTES_DATA']; + $oldExtendedData = empty($json) ? [] : json_decode($json, true); + $extendedData = array_merge($oldExtendedData, $extendedData); + $arrayUserDataUpdate['USR_EXTENDED_ATTRIBUTES_DATA'] = json_encode($extendedData); + } + if (!empty($arrayUserDataUpdate)) { $arrayUserDataUpdate['USR_UID'] = $arrayUser[$username]['USR_UID']; diff --git a/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue b/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue index 502672bdd..4cf76f037 100644 --- a/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue +++ b/workflow/engine/methods/authenticationSources/src/components/matchAttributes.vue @@ -109,14 +109,15 @@ deleteAttributeProcess() { this.rows.splice(this.selectedRowIndex - 1, 1); }, - saveRow(obj) { + saveRow(object) { + let obj = Object.assign({}, object);//important to clone the object if (obj.index === null) { delete obj.index; this.rows.push(obj); } else { let i = obj.index; delete obj.index; - this.rows[i - 1] = obj; + Object.assign(this.rows[i - 1], obj); } }, connectionSettings() {