mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
LDAP: Updated default user filter placeholder format
To not conflict with env variables, and to align with placeholders used for PDF gen command. Added test to cover, including old format supported for back-compatibility. For #4967
This commit is contained in:
@ -249,13 +249,18 @@ class LdapService
|
||||
|
||||
/**
|
||||
* Build a filter string by injecting common variables.
|
||||
* Both "${var}" and "{var}" style placeholders are supported.
|
||||
* Dollar based are old format but supported for compatibility.
|
||||
*/
|
||||
protected function buildFilter(string $filterString, array $attrs): string
|
||||
{
|
||||
$newAttrs = [];
|
||||
foreach ($attrs as $key => $attrText) {
|
||||
$newKey = '${' . $key . '}';
|
||||
$newAttrs[$newKey] = $this->ldap->escape($attrText);
|
||||
$escapedText = $this->ldap->escape($attrText);
|
||||
$oldVarKey = '${' . $key . '}';
|
||||
$newVarKey = '{' . $key . '}';
|
||||
$newAttrs[$oldVarKey] = $escapedText;
|
||||
$newAttrs[$newVarKey] = $escapedText;
|
||||
}
|
||||
|
||||
return strtr($filterString, $newAttrs);
|
||||
|
Reference in New Issue
Block a user