feat: add a permission-gated UI action registry and action slots for plugins

Moves the terminal toolbar's hardwired AI button into a slot the ssh-terminal
plugin offers and the ai plugin fills, gated on ai.services.use.
This commit is contained in:
LukeGus committed 2026-09-21 16:56:15 -05:00
1 parent 225f618337
commit 2d6c1cdecb
29 files changed
+1971 -40

No files matched your search

+22
View File
@@ -54,6 +54,13 @@ export async function updateRole(
): Promise<{ role: Role }> {
try {
const response = await rbacApi.put(`/rbac/roles/${roleId}`, roleData);
if (roleData.permissions) {
// The editing admin may hold this role, so re-read our own grants
// rather than leaving gated UI stale until the next reload.
const { notifyPermissionsChanged } =
await import("@/hooks/use-permissions");
notifyPermissionsChanged();
}
return response.data;
} catch (error) {
throw handleApiError(error, "update role");
@@ -277,6 +284,21 @@ export async function getPermissionsCatalog(): Promise<{
}
}
export interface MyPermissions {
permissions: string[];
isAdmin: boolean;
}
/** The current user's own grants, for hiding UI they could not use. */
export async function getMyPermissions(): Promise<MyPermissions> {
try {
const response = await rbacApi.get("/rbac/permissions/me");
return response.data;
} catch (error) {
throw handleApiError(error, "fetch permissions");
}
}
export async function getSharedHosts(): Promise<{
sharedHosts: Array<{
id: number;