Skip to content

Commit

Permalink
Making the mail attribute optional if the user attribute is there
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris McIntosh authored and Jared Murrell committed Jan 5, 2022
1 parent 380233e commit cd035ed
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions githubapp/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,16 @@ def get_group_members(self, group_name):
username = str(
member_dn["attributes"][self.LDAP_USER_ATTRIBUTE][0]
).casefold()
email = str(
member_dn["attributes"][
self.LDAP_USER_MAIL_ATTRIBUTE
][0]
).casefold()
if member_dn["attributes"][
self.LDAP_USER_MAIL_ATTRIBUTE
]:
email = str(
member_dn["attributes"][
self.LDAP_USER_MAIL_ATTRIBUTE
][0]
).casefold()
else:
email = None
user_info = {"username": username, "email": email}
member_list.append(user_info)
except Exception as e:
Expand Down

0 comments on commit cd035ed

Please sign in to comment.