perf(ldap): LDAP用户搜索,本地忽略大小写,远端支持模糊

pull/4943/head
Bai 2020-11-05 14:55:22 +08:00 committed by Jiangjie.Bai
parent eabaae81ac
commit 2690092faf
1 changed files with 2 additions and 2 deletions

View File

@ -125,7 +125,7 @@ class LDAPServerUtil(object):
return '(|{})'.format(extra) return '(|{})'.format(extra)
if self.search_value: if self.search_value:
for attr in self.config.attr_map.values(): for attr in self.config.attr_map.values():
extra += '({}={})'.format(attr, self.search_value) extra += '({}={})'.format(attr, '*{}*'.format(self.search_value))
return '(|{})'.format(extra) return '(|{})'.format(extra)
return extra return extra
@ -222,7 +222,7 @@ class LDAPCacheUtil(object):
elif self.search_value: elif self.search_value:
filter_users = [ filter_users = [
user for user in users user for user in users
if self.search_value in ','.join(user.values()) if self.search_value.lower() in ','.join(user.values()).lower()
] ]
else: else:
filter_users = users filter_users = users