Unverified Commit afd82b9e authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(archive) Take archives into account when applying template mask

This will avoid a unique template mask like %n|% returning a value
already used by an archived object.

issue #6119
Showing with 7 additions and 0 deletions
+7 -0
...@@ -246,6 +246,13 @@ class templateHandling ...@@ -246,6 +246,13 @@ class templateHandling
$ldap->cd($config->current['BASE']); $ldap->cd($config->current['BASE']);
/* Return the first found unique value */ /* Return the first found unique value */
foreach ($generator as $value) { foreach ($generator as $value) {
if (class_available('archivedObject')) {
$filter = archivedObject::buildUniqueSearchFilter($unique, $value);
$ldap->search($filter, ['dn']);
if ($ldap->count() > 0) {
continue;
}
}
$filter = '('.ldap_escape_f($unique).'='.ldap_escape_f($value).')'; $filter = '('.ldap_escape_f($unique).'='.ldap_escape_f($value).')';
$ldap->search($filter, ['dn']); $ldap->search($filter, ['dn']);
if ($ldap->count() == 0) { if ($ldap->count() == 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment