1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 17:34:21 +01:00

adding the possibility to get a list of attributes in get_user

This commit is contained in:
kakwa 2015-05-22 09:51:46 +02:00
parent f4906bb090
commit ab8c380bb1

View File

@ -56,7 +56,7 @@ class Backend(ldapcherry.backend.Backend):
def del_user(self, username): def del_user(self, username):
pass pass
def get_user(self, username): def get_user(self, username, attrs=None):
ldap_client = self._connect() ldap_client = self._connect()
try: try:
ldap_client.simple_bind_s(self.binddn, self.bindpassword) ldap_client.simple_bind_s(self.binddn, self.bindpassword)
@ -80,7 +80,8 @@ class Backend(ldapcherry.backend.Backend):
r = ldap_client.search_s(self.userdn, r = ldap_client.search_s(self.userdn,
ldap.SCOPE_SUBTREE, ldap.SCOPE_SUBTREE,
user_filter user_filter,
attrlist=attrs
) )
if len(r) == 0: if len(r) == 0:
ldap_client.unbind_s() ldap_client.unbind_s()