Added support for multiple placeholders for LDAP_USER_FILTER

This commit is contained in:
Frederic Guillot
2016-03-17 22:24:11 -04:00
parent e3e08d0e34
commit 24c224ddc2
3 changed files with 31 additions and 5 deletions

View File

@@ -211,14 +211,15 @@ class User
*
* @access public
* @param string $username
* @param string $filter
* @return string
*/
public function getLdapUserPattern($username)
public function getLdapUserPattern($username, $filter = LDAP_USER_FILTER)
{
if (! LDAP_USER_FILTER) {
if (! $filter) {
throw new LogicException('LDAP user filter empty, check the parameter LDAP_USER_FILTER');
}
return sprintf(LDAP_USER_FILTER, $username);
return str_replace('%s', $username, $filter);
}
}