Merged in bugfix/PMCORE-3817 (pull request #8439)

PMCORE-3817 Authentication Sources does not work when User extended attributes is used

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Roly Gutierrez
2022-04-28 19:06:21 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 18 additions and 4 deletions

View File

@@ -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'];

View File

@@ -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() {