fix(auth): let PROXY_ADMIN_VIEW_ONLY call the Usage Ask AI route

POST /usage/ai/chat is written for admins and admin viewers alike
(_user_has_admin_view), but the viewer route gate only passes POSTs on
the explicit allowlist, and this path was never added. Viewers got
'user not allowed to access this route'. The route only reads the daily
activity aggregates that /user/daily/activity already serves them.
This commit is contained in:
juser0719 2026-10-16 09:23:12 +09:00
parent 4496fe0ebc
commit 493c28a45c
No known key found for this signature in database
GPG key ID: E34488CB69ECB58F
2 changed files with 3 additions and 0 deletions

View file

@ -957,6 +957,8 @@ class LiteLLMRoutes(enum.Enum):
"/user/available_users",
"/user/available_roles",
"/user/daily/activity",
# Usage > Ask AI: a POST that only reads daily activity aggregates.
"/usage/ai/chat",
"/user/daily/activity/aggregated",
"/user/daily/activity/aggregated/keys",
"/user/daily/activity/aggregated/search",

View file

@ -350,6 +350,7 @@ def test_proxy_admin_viewer_blocked_management_writes(blocked_route):
"/model/info",
"/jwt/key/mapping/list",
"/jwt/key/mapping/info",
"/usage/ai/chat",
],
)
def test_proxy_admin_viewer_allowed_management_reads(allowed_read_route):