fix: department exclusion + correct auto-approval flow
This commit is contained in:
+3
-4
@@ -171,7 +171,7 @@ def find_user_in_ad(requester, caller_phone=None, ticket_id=None):
|
||||
server = Server(AD_SERVER, get_info=ALL, connect_timeout=AD_CONNECT_TIMEOUT)
|
||||
conn = Connection(server, user=AD_USER, password=AD_PASSWORD, auto_bind=True, receive_timeout=AD_RECEIVE_TIMEOUT)
|
||||
conn.search(search_base=AD_BASE, search_filter=ldap_filter, attributes=["l", "company", "manager"])
|
||||
if not conn.entries:
|
||||
conn.search(search_base=AD_BASE, search_filter=ldap_filter, attributes=["l", "company", "manager", "department"])
|
||||
log_to_file(f" [AD] ❌ Объект ({search_by}) не найден in AD!", ticket_id)
|
||||
return None
|
||||
|
||||
@@ -196,7 +196,6 @@ def find_user_in_ad(requester, caller_phone=None, ticket_id=None):
|
||||
|
||||
department = user.department.value if "department" in user and user.department.value else None
|
||||
return {"city": city, "company": company, "ad_path": ad_path, "manager_email": manager_email, "source": f"AD ({search_by})"}
|
||||
return {"city": city, "company": company, "department": department, "ad_path": ad_path, "manager_email": manager_email, "source": f"AD ({search_by})"}
|
||||
return None
|
||||
|
||||
def resolve_support_group(qdrant_group, city, company, ad_path):
|
||||
@@ -903,10 +902,10 @@ def process_ticket_logic(req_id):
|
||||
t_log(" ⏭ Пропуск: пользователь в исключённом отделе.")
|
||||
continue
|
||||
t_log(f"✔ Условия совпали. Запуск процесса согласования для {manager_email}...")
|
||||
if manager_email:
|
||||
ai_was_used = True
|
||||
if is_city_ok and (is_group_ok or is_cat_ok):
|
||||
|
||||
ai_was_used = True
|
||||
t_log(f"✔ Условия совпали. Запуск процесса согласования для {manager_email}...")
|
||||
share_success, share_log = share_ticket_for_approval(req_id, manager_email)
|
||||
t_log(share_log)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user