Show account names and roles on cards from scheduled scans
Cards from scheduled scans of editor-saved profiles showed the account's
GUID as its name and no Elev/Ansat badge: the profile editor stored bare
id strings, the scheduler passes them straight to run_scan, and run_scan
normalised them to displayName=<id>, userRole="other". Before 1.7.10 the
scan-start profile overwrite kept repairing profiles to named objects,
which is why this surfaced now.
- run_scan: _enrich_bare_users() looks bare accounts up in the directory
(list_users, falling back to lookup_user) for name and role.
- M365Connector.build_role_sku_map(): the SKU map /api/users built inline,
now shared so cards and the account list classify roles identically.
lookup_user() also returns assignedLicenses.
- Profile editor saves {id, displayName, userRole} (manual accounts keep
email/manual), like the 💾 save.
- _accountPill: an account_name equal to account_id counts as missing;
name and role are filled from the loaded user list, so existing cards
display correctly without a rescan.
- Excel export: the scan's account-name map no longer breaks on bare id
strings (.get() on a str raised and dropped the whole map).
Tests: tests/test_account_names.py (10); the run_scan test fails on the
old engine with "Collecting emails — guid-henrik…".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c55db48894
commit
20156ffc93
8 files changed
+283
-37
No files matched your search
+5
-1
@@ -744,9 +744,13 @@ def _build_article30_docx() -> tuple[bytes, str]:
|
||||
# user_ids are stored in the options JSON column
|
||||
opts_json = json.loads(row["options"] or "{}") if row else {}
|
||||
for u in opts_json.get("user_ids", []):
|
||||
# Scheduled scans of editor-saved profiles stored bare id
|
||||
# strings; .get() on those raised and dropped the whole map.
|
||||
if not isinstance(u, dict):
|
||||
continue
|
||||
uid = u.get("id", "")
|
||||
name = u.get("displayName", "")
|
||||
if uid and name:
|
||||
if uid and name and name != uid:
|
||||
_acct_map[uid] = name
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user