Skip to content

Commit

Permalink
adding the possibility to get a list of attributes in get_user
Browse files Browse the repository at this point in the history
  • Loading branch information
kakwa committed May 22, 2015
1 parent f4906bb commit ab8c380
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ldapcherry/backend/backendLdap.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def add_user(self, username):
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)
Expand All @@ -80,8 +80,9 @@ def get_user(self, username):

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
Expand Down

0 comments on commit ab8c380

Please sign in to comment.