This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/main by this push:
new f8f436e Get multiple LDAP email field values correctly
f8f436e is described below
commit f8f436e52dfae1b42bdfc12379cdc331b8b8510c
Author: Sean B. Palmer <[email protected]>
AuthorDate: Sun Nov 16 14:52:00 2025 +0000
Get multiple LDAP email field values correctly
---
atr/util.py | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/atr/util.py b/atr/util.py
index 941a838..b5137ba 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -304,12 +304,13 @@ async def email_mid_from_thread_id(thread_id: str) ->
tuple[str, str]:
async def email_to_uid_map() -> dict[str, str]:
- def get(entry: dict, prop: str) -> str | None:
- if prop in entry:
- values = entry[prop]
- if values:
- return values[0]
- return None
+ def values(entry: dict, prop: str) -> list[str]:
+ raw_values = entry.get(prop, [])
+ if isinstance(raw_values, list):
+ return [v for v in raw_values if v]
+ if raw_values:
+ return [raw_values]
+ return []
# Get all email addresses in LDAP
conf = config.AppConfig()
@@ -327,12 +328,13 @@ async def email_to_uid_map() -> dict[str, str]:
email_to_uid = {}
for entry in ldap_params.results_list:
uid = entry.get("uid", [""])[0]
- if mail := get(entry, "mail"):
- email_to_uid[mail.lower()] = uid.lower()
- if alt_email := get(entry, "asf-altEmail"):
- email_to_uid[alt_email.lower()] = uid.lower()
- if committer_email := get(entry, "asf-committer-email"):
- email_to_uid[committer_email.lower()] = uid.lower()
+ uid_lower = uid.lower()
+ for mail in values(entry, "mail"):
+ email_to_uid[mail.lower()] = uid_lower
+ for alt_email in values(entry, "asf-altEmail"):
+ email_to_uid[alt_email.lower()] = uid_lower
+ for committer_email in values(entry, "asf-committer-email"):
+ email_to_uid[committer_email.lower()] = uid_lower
return email_to_uid
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]