Skip to content

Commit

Permalink
Merge pull request #337 from fasrc/development
Browse files Browse the repository at this point in the history
improve error message for return_user_by_name
  • Loading branch information
claire-peters authored Sep 4, 2024
2 parents 40c8b34 + 495aeea commit 5571811
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coldfront/plugins/ldap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def return_user_by_name(self, username, return_as='dict', attributes=ALL_ATTRIBU
"""Return an AD user entry by the username"""
user = self.search_users({"uid": username}, return_as=return_as, attributes=attributes)
if len(user) > 1:
raise ValueError("too many users in value returned")
raise ValueError(f"too many users in value returned for username {username}")
if not user:
raise ValueError("no users returned")
raise ValueError(f"no users returned for username {username}")
return user[0]

def return_group_by_name(self, groupname, return_as='dict', attributes=ALL_ATTRIBUTES):
Expand Down

0 comments on commit 5571811

Please sign in to comment.