From 0a2aeb65cec77e7a2dc0a71c1d5464cf205973f7 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sun, 22 Nov 2026 02:43:06 +1100 Subject: [PATCH] feat(ui): members, policies and denials pages use the binary's access API (#2023) --- ui/src/audit/DenialsPage.vue | 14 ++++++++- ui/src/audit/denials.ts | 2 ++ ui/src/lib/api.ts | 15 +++++++-- ui/src/org/OrgMembersPage.vue | 44 +++++++++++++++++++++----- ui/src/org/org.ts | 3 ++ ui/src/stores/denials.ts | 59 ++++++++++++++++++++++++++++------- 6 files changed, 116 insertions(+), 21 deletions(-) diff --git a/ui/src/audit/DenialsPage.vue b/ui/src/audit/DenialsPage.vue index 8e3e96cb0..94cbec4f3 100644 --- a/ui/src/audit/DenialsPage.vue +++ b/ui/src/audit/DenialsPage.vue @@ -8,6 +8,7 @@ import { ReadError } from "@/components/ui/read-error"; import { Button } from "@/components/ui/button"; import { DataTable, type DataTableColumn } from "@/components/ui/data-table"; import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty"; +import { Input } from "@/components/ui/input"; import { Section } from "@/components/ui/section"; import { Spinner } from "@/components/ui/spinner"; import { Timestamp } from "@/components/ui/timestamp"; @@ -15,7 +16,7 @@ import { useDenialsStore } from "@/stores/denials"; import { denialResource, type Denial } from "./denials"; const store = useDenialsStore(); -const { denials, loading, error } = storeToRefs(store); +const { denials, filters, more, loading, error } = storeToRefs(store); const columns: DataTableColumn[] = [ { id: "at", label: "When", fixed: true, sort: (d) => d.at }, @@ -39,6 +40,15 @@ onMounted(() => void store.load());
+
+ + + + + + + +

Loading denials… @@ -57,6 +67,7 @@ onMounted(() => void store.load()); No denials recorded + @@ -65,6 +76,7 @@ onMounted(() => void store.load()); +

diff --git a/ui/src/audit/denials.ts b/ui/src/audit/denials.ts index 9d90e0836..afba044a8 100644 --- a/ui/src/audit/denials.ts +++ b/ui/src/audit/denials.ts @@ -14,6 +14,8 @@ export interface Denial { export interface DenialsResponse { denials: Denial[]; + /** Whether older refusals match beyond this page. */ + more: boolean; } /** The resource column: the kind and id together, or just the kind. */ diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index 0cf933134..e1b052391 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -281,8 +281,8 @@ export const api = { health: () => request("/health/detailed"), services: () => request("/api/services"), policies: () => request("/api/access/policies"), - denials: (limit?: number) => - request(`/api/access/denials${limit ? `?limit=${limit}` : ""}`), + denials: (params: QueryParams = {}) => + request("/api/access/denials" + qs(params)), putPolicy: (policy: unknown) => request<{ version: number }>("/api/access/policies", { method: "PUT", body: policy }), deletePolicy: (policy: unknown) => @@ -359,6 +359,17 @@ export const api = { qs({ workspace }), { method: "DELETE", parse: false }, ), + /** Suspending stops a member acting at once; their memberships stay. */ + suspendOrgMember: (id: string, identity: string) => + request( + `/api/orgs/${encodeURIComponent(id)}/members/${encodeURIComponent(identity)}/suspend`, + { method: "POST", parse: false }, + ), + reactivateOrgMember: (id: string, identity: string) => + request( + `/api/orgs/${encodeURIComponent(id)}/members/${encodeURIComponent(identity)}/reactivate`, + { method: "POST", parse: false }, + ), assignOrgAgent: (id: string, identity: string) => request( `/api/orgs/${encodeURIComponent(id)}/agents/${encodeURIComponent(identity)}`, diff --git a/ui/src/org/OrgMembersPage.vue b/ui/src/org/OrgMembersPage.vue index a1d81242a..a737d6623 100644 --- a/ui/src/org/OrgMembersPage.vue +++ b/ui/src/org/OrgMembersPage.vue @@ -7,7 +7,10 @@ import CreateAccount from "@/accounts/CreateAccount.vue"; import { Section } from "@/components/ui/section"; import { storeToRefs } from "pinia"; import { computed, onMounted, ref } from "vue"; -import { Plus, Trash2 } from "@lucide/vue"; +import { Pause, Play, Plus, Trash2 } from "@lucide/vue"; + +import { Badge } from "@/components/ui/badge"; +import { Timestamp } from "@/components/ui/timestamp"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -128,6 +131,16 @@ const setRole = (member: Member, role: unknown) => await load(); }); +const toggleStatus = (member: Member) => + run(member.identity_id + "status", async () => { + if (!org.value) return; + await (member.status === "suspended" ? api.reactivateOrgMember : api.suspendOrgMember)( + org.value.id, + member.identity_id, + ); + await load(); + }); + const pending = ref(null); const remove = (member: Member) => run(member.identity_id + (member.workspace_id ?? ""), async () => { @@ -151,7 +164,9 @@ const remove = (member: Member) => Kind Workspace Role - Actions + Status + Last sign-in + Actions @@ -169,7 +184,22 @@ const remove = (member: Member) => + {{ member.status }} + + + + + + {{ member.status === "suspended" ? "Reactivate" : "Suspend" }} + @@ -186,10 +216,10 @@ const remove = (member: Member) => - Loading members… + Loading members… - + No members yet @@ -202,8 +232,8 @@ const remove = (member: Member) => -
-
+
+