Skip to content

Commit

Permalink
Fix directory.get_user
Browse files Browse the repository at this point in the history
  • Loading branch information
txels committed Apr 7, 2024
1 parent cc19346 commit 290f097
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions humans/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ def create_user(connection, username, uid_number):


def get_user(connection, username):
name = username.encode("utf-8")
base_dn = "dc=pirata,dc=cat"
user_dn = f"cn={name.decode()},{base_dn}"

search_dn = f"uid={username},ou=afiliats,dc=pirata,dc=cat"
try:
result = connection.search_s(user_dn, ldap.SCOPE_BASE)
result = connection.search_s(search_dn, ldap.SCOPE_BASE)
_, attrs = result[0]
return attrs
except:
Expand Down

0 comments on commit 290f097

Please sign in to comment.