fix: convert UPN @sibcem.ru to @tcs.sibcem.ru for SD API requester
This commit is contained in:
@@ -94,11 +94,11 @@ def get_ad_user_info(user_id: str) -> dict | None:
|
|||||||
raw_mail = str(entry.mail) if 'mail' in entry else ""
|
raw_mail = str(entry.mail) if 'mail' in entry else ""
|
||||||
# mail может быть "[]" (пустой LDAP объект), "" или "N/A" — фильтруем
|
# mail может быть "[]" (пустой LDAP объект), "" или "N/A" — фильтруем
|
||||||
mail = raw_mail if raw_mail and raw_mail not in ("[]", "N/A", "") else None
|
mail = raw_mail if raw_mail and raw_mail not in ("[]", "N/A", "") else None
|
||||||
# Fallback: используем UPN если mail пустой
|
# Fallback: используем UPN если mail пустой, конвертируем @sibcem.ru → @tcs.sibcem.ru
|
||||||
if not mail:
|
if not mail:
|
||||||
raw_upn = str(entry.userPrincipalName) if 'userPrincipalName' in entry else ""
|
raw_upn = str(entry.userPrincipalName) if 'userPrincipalName' in entry else ""
|
||||||
if raw_upn and raw_upn not in ("[]", "N/A", ""):
|
if raw_upn and raw_upn not in ("[]", "N/A", ""):
|
||||||
mail = raw_upn
|
mail = raw_upn.replace("@sibcem.ru", "@tcs.sibcem.ru")
|
||||||
city = str(entry.l) if 'l' in entry and entry.l.value else "Кемерово"
|
city = str(entry.l) if 'l' in entry and entry.l.value else "Кемерово"
|
||||||
return {"cn": cn, "mail": mail, "city": city}
|
return {"cn": cn, "mail": mail, "city": city}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user