LocalAI/core/http/auth
LocalAI [bot] f0cb02afb8
feat(usage): attribute Sources rows to user accounts in admin view (#9935)
The merged feature (#9920) let admins see per-API-key and per-source
totals but did not surface which user owned each key, and lumped
every user's Web UI traffic into a single global Web UI row. This
makes the admin Sources tab properly per-user attributable:

- KeyTotal gains UserID + UserName, populated from the snapshot the
  usage middleware already records. The by_key roll-up now groups by
  (api_key_id, api_key_name, user_id, user_name).
- New SourceTotals.ByUserSource roll-up groups (source, user_id,
  user_name) for sources without a key identity (web, legacy). Only
  populated on the admin path (includeLegacy=true); the non-admin
  endpoint stays unchanged for backwards compatibility.
- SourcesTable accepts showUserColumn={isAdmin}; admin view renders
  a User column, makes the search match user name/id, and expands
  Web UI / legacy pseudo-rows from the global aggregate to one row
  per user using by_user_source.

Refs: #9862

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-05-21 23:23:06 +02:00
..
apikeys.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
apikeys_test.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
auth_suite_test.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
branding_routes_test.go feat(branding): admin-configurable instance name, tagline, and assets (#9635) 2026-05-02 15:51:36 +02:00
db.go feat(usage): track and visualise usage per API key (#9920) 2026-05-21 16:34:02 +02:00
db_nosqlite.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
db_sqlite.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
db_test.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
features.go feat(api): add /v1/audio/diarization endpoint with sherpa-onnx + vibevoice.cpp (#9654) 2026-05-05 15:10:13 +02:00
helpers_test.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
middleware.go feat(usage): track and visualise usage per API key (#9920) 2026-05-21 16:34:02 +02:00
middleware_test.go feat(usage): track and visualise usage per API key (#9920) 2026-05-21 16:34:02 +02:00
models.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
oauth.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
oauth_email_decision.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
oauth_email_decision_test.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
password.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
password_test.go chore: Security hardening (#9719) 2026-05-08 16:25:45 +02:00
permissions.go feat(api): add /v1/audio/diarization endpoint with sherpa-onnx + vibevoice.cpp (#9654) 2026-05-05 15:10:13 +02:00
quota.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
roles.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
roles_test.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
session.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
session_test.go feat: add users and authentication support (#9061) 2026-03-19 21:40:51 +01:00
usage.go feat(usage): attribute Sources rows to user accounts in admin view (#9935) 2026-05-21 23:23:06 +02:00
usage_test.go feat(usage): attribute Sources rows to user accounts in admin view (#9935) 2026-05-21 23:23:06 +02:00
users.go fix(auth): cascade user deletion across all owned data on PostgreSQL (#9702) 2026-05-07 08:28:58 +02:00
users_test.go fix(auth): cascade user deletion across all owned data on PostgreSQL (#9702) 2026-05-07 08:28:58 +02:00