1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-12-23 05:10:03 +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):
pass
def get_user(self, username):
def get_user(self, username, attrs=None):
ldap_client = self._connect()
try:
ldap_client.simple_bind_s(self.binddn, self.bindpassword)
@ -80,8 +80,9 @@ class Backend(ldapcherry.backend.Backend):
r = ldap_client.search_s(self.userdn,
ldap.SCOPE_SUBTREE,
user_filter
)
user_filter,
attrlist=attrs
)
if len(r) == 0:
ldap_client.unbind_s()
return False