filter by substring match instead of exact match

This commit is contained in:
Roland Gruber 2019-11-09 11:08:42 +01:00
parent a3f0c07096
commit 714dbaa0fd
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,6 @@
December 2019 7.0
- Lamdaemon can be configured with directory prefix for homedirs
- Account list filters match on substrings instead of whole value
- Fixed bugs:
-> Missing CSS for Duo

View File

@ -1080,7 +1080,14 @@ class lamList {
if (!$this->isAttributeFilteredByServer($attr)) {
continue;
}
$text .= '(' . $attr . '=' . $filter . ')';
$filterExpression = $filter;
if (strpos($filter, '*') !== 0) {
$filterExpression = '*' . $filterExpression;
}
if (strrpos($filter, '*') !== (strlen($filter) - 1)) {
$filterExpression = $filterExpression . '*';
}
$text .= '(' . $attr . '=' . $filterExpression . ')';
}
return $text;
}
@ -1113,7 +1120,7 @@ class lamList {
continue;
}
$regex = str_replace(array('*'), array('.*'), $filterValue);
$regex = '/^' . $regex . '$/i';
$regex = '/' . $regex . '/i';
if (!$this->isFilterMatching($data, $filterAttribute, $regex)) {
$toFilter[] = $index;
}