modification pour support des valeurs spéciales (ne sont pas synchronisées) dans LDAP

This commit is contained in:
Jephté Clain 2020-02-13 09:04:26 +04:00
parent 98129cd400
commit 08c081ac33
1 changed files with 51 additions and 7 deletions

View File

@ -582,19 +582,63 @@ function deli(num, i, j) {
}
function del(field) { deli(geth(field)) }
function comparevic(field1, value1, field2, value2, icfields, array) {
function __starts_with(prefix, string) {
return substr(string, 1, length(prefix)) == prefix
}
function __comparevic_truth(retval) {
return substr(retval, 1, 1) == "1"
}
function __comparevic_suffix(retval) {
return substr(retval, 2)
}
function comparevic(field1, value1, field2, value2, icfields, spfields, array, i, vs, f, prefix, suffix) {
# tester si on est un champ spécial.
prefix = ""
split(spfields, array, /,/)
for (i in array) {
split(array[i], vs, /=/)
f = tolower(vs[1])
if (f == tolower(field1) || f == tolower(field2)) {
prefix = vs[2]
break
}
}
suffix = ""
if (prefix != "") {
# les valeurs ayant le préfixe spécifié sont ignorées
split(value1, array, /;/)
array_new(vs)
for (i in array) {
if (!__starts_with(prefix, array[i])) {
array_add(vs, array[i])
} else {
if (suffix != "") suffix = suffix ";"
suffix = suffix array[i]
}
}
value1 = array_join(vs, ";")
split(value2, array, /;/)
array_new(vs)
for (i in array) {
if (!__starts_with(prefix, array[i])) {
array_add(vs, array[i])
}
}
value2 = array_join(vs, ";")
}
split(icfields, array, /,/)
if (in_array(field1, array, 1) || in_array(field2, array, 1)) {
return tolower(value1) == tolower(value2)
i = tolower(value1) == tolower(value2)? "1": "0"
} else {
return value1 == value2
i = value1 == value2? "1": "0"
}
return i suffix
}
function ocompareic(field1, field2, icfields, v1, v2, array) {
return comparevic(field1, oget(field1), field2, oget(field2), icfields)
function ocompareic(field1, field2, icfields, spfields, v1, v2, array) {
return comparevic(field1, oget(field1), field2, oget(field2), icfields, spfields)
}
function compareic(field1, field2, icfields, v1, v2, array) {
return comparevic(field1, get(field1), field2, get(field2), icfields)
function compareic(field1, field2, icfields, spfields, v1, v2, array) {
return comparevic(field1, get(field1), field2, get(field2), icfields, spfields)
}
function infields(field, fields, array) {
split(fields, array, /,/)