From 80b15c86c941d1b4772999e30ad06c392d9ece1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81=20=D0=9A=D1=80=D0=B8=D0=B2?= =?UTF-8?q?=D0=BE=D1=87=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 29 Jul 2026 00:55:26 +0700 Subject: [PATCH] fix: convert UPN @sibcem.ru to @tcs.sibcem.ru for SD API requester --- instruct/handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instruct/handlers.py b/instruct/handlers.py index 5e7edb8..ebb0dd2 100644 --- a/instruct/handlers.py +++ b/instruct/handlers.py @@ -94,11 +94,11 @@ def get_ad_user_info(user_id: str) -> dict | None: raw_mail = str(entry.mail) if 'mail' in entry else "" # mail может быть "[]" (пустой LDAP объект), "" или "N/A" — фильтруем 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: raw_upn = str(entry.userPrincipalName) if 'userPrincipalName' in entry else "" 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 "Кемерово" return {"cn": cn, "mail": mail, "city": city} except Exception as e: