mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
check group name in ldap result (#150)
This commit is contained in:
parent
8f32f9ae11
commit
0c4d21f204
@ -88,10 +88,10 @@ class Plugin(BaseAuthService):
|
|||||||
base=self.__base,
|
base=self.__base,
|
||||||
scope=ldap.SCOPE_SUBTREE,
|
scope=ldap.SCOPE_SUBTREE,
|
||||||
filterstr=f"(&(objectClass=user)(userPrincipalName={user})(memberOf={self.__group}))",
|
filterstr=f"(&(objectClass=user)(userPrincipalName={user})(memberOf={self.__group}))",
|
||||||
attrlist=["userPrincipalName", "memberOf"],
|
attrlist=["memberOf"],
|
||||||
timeout=self.__timeout,
|
timeout=self.__timeout,
|
||||||
) or []):
|
) or []):
|
||||||
if dn is not None and isinstance(attrs, dict) and attrs.get("memberOf"):
|
if dn is not None and isinstance(attrs, dict) and self.__group.encode() in attrs.get("memberOf"): # type: ignore
|
||||||
return True
|
return True
|
||||||
except ldap.INVALID_CREDENTIALS:
|
except ldap.INVALID_CREDENTIALS:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user