fix(jira): honor jira_email override in account-id lookup, not just email
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled

lookup_user_jira_account_id() only ever searched by Aegis login email,
ignoring the jira_email override field that exists precisely for users
whose corporate Atlassian email differs from their Aegis login email
(the rest of jira_service.py already documents and uses this priority
order). Found via jesus-huertas, whose real Jira account uses a
different email than his Aegis account.
This commit is contained in:
kitos
2026-07-10 13:42:33 +02:00
parent a46aa157f3
commit 1535ddaa5d
2 changed files with 27 additions and 1 deletions
+4 -1
View File
@@ -295,6 +295,9 @@ def get_admin_jira_client(db: Session):
def lookup_user_jira_account_id(db: Session, user: User) -> bool:
"""Lookup *user*'s Atlassian account ID by email using the admin Jira client.
Uses ``user.jira_email`` when set (for users whose corporate Atlassian
email differs from their Aegis login email), falling back to
``user.email`` — same resolution order as the rest of this module.
Updates ``user.jira_account_id`` in-place when found or changed.
Returns ``True`` when the value was updated, ``False`` otherwise.
Non-fatal — all errors are logged at DEBUG level and swallowed.
@@ -302,7 +305,7 @@ def lookup_user_jira_account_id(db: Session, user: User) -> bool:
if not has_admin_jira_configured(db):
return False
email = getattr(user, "email", None)
email = getattr(user, "jira_email", None) or getattr(user, "email", None)
if not email:
return False