Commit 37490c0b authored by Côme Chilliet's avatar Côme Chilliet

feat(simple-management): Allow raw LDAP filters

This allows to use any LDAP filter instead of the usual search filter
 used on any management class.
For instance in user list, you can enter (mail=a*) to search for all
 users having a value starting by a in the mail attribute.
The entries will also have to match what you checked in the checkboxes,
 this filter only replaces the text search part of the filter.
An LDAP filter is detected by starting and ending with parenthesis.

issue #5135
parent 8004d446
......@@ -467,8 +467,12 @@ class filter
$e_unset = preg_replace('/\\\\\$/', '$', $e_unset);
$filter = preg_replace("/\\$$tag/", $e_unset, $filter);
} else {
$e_set = preg_replace('/([^\\\\])\$/', '${1}'.ldap_escape_f($this->elementValues[$tag]), $e_set);
$e_set = preg_replace('/\\\\\$/', '$', $e_set);
if (($element['type'] == 'textfield') && (preg_match('/^\(.+\)$/', $this->elementValues[$tag]))) {
$e_set = $this->elementValues[$tag];
} else {
$e_set = preg_replace('/([^\\\\])\$/', '${1}'.ldap_escape_f($this->elementValues[$tag]), $e_set);
$e_set = preg_replace('/\\\\\$/', '$', $e_set);
}
$filter = preg_replace("/\\$$tag/", $e_set, $filter);
}
}
......
Markdown is supported
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