fix: update the tracking usage filter for the usage page

This commit is contained in:
2026-07-11 18:36:55 +07:00
parent 40606ce39f
commit e1232ed1bd
11 changed files with 422 additions and 241 deletions
+15
View File
@@ -30,6 +30,21 @@ describe("usage access scope SQL predicates", () => {
expect(params).toEqual(["connection-a", "connection-b", "key-a"]);
});
it("uses persisted actor attribution when a user id is available", () => {
const conditions = [];
const params = [];
appendUsageAccessClause(conditions, params, {
isAdmin: false,
userId: "user-a",
connectionIds: ["connection-a"],
apiKeys: ["key-a"],
});
expect(conditions).toEqual(["userId = ?"]);
expect(params).toEqual(["user-a"]);
});
it("denies users with no attributable resources", () => {
const conditions = [];
const params = [];