fix: users loop clobbered requesting username in settings filtering

The users-section loop reused 'username' as its loop variable, overwriting
the requesting user's name so host/threshold filtering compared against the
last user in the config. Rename to 'uname' and add a regression test with a
user that is not last in the users dict.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NfPpSpccTWBfZg1FTveyaU
This commit is contained in:
2026-07-09 18:48:05 -04:00
co-authored by Claude Fable 5
parent 447b9574a3
commit f06b2ef9e8
2 changed files with 15 additions and 2 deletions
+2 -2
View File
@@ -238,11 +238,11 @@ def get_settings_sections(config: dict, threshold_checker=None, user=None) -> li
# ---- Users (show metadata only, never password hashes) ----------------
users_list = []
for username, attrs in (config.get("users") or {}).items():
for uname, attrs in (config.get("users") or {}).items():
if not isinstance(attrs, dict):
continue
users_list.append({
"username": username,
"username": uname,
"full_name": attrs.get("full_name", ""),
"admin": bool(attrs.get("admin", False)),
"avatar": attrs.get("avatar", ""),