Edit Authentik groups: rename and change members

Apps → Authentik gets a Groups section for administrators: the groups with
member counts, and an Edit form to rename one and put users in and take them
out. Members are changed one user at a time, never by replacing the list.
Everything is checked first and nothing changes unless all of it may; service
accounts, the token's own account and the last active administrator losing
that are refused. Whether a group makes administrators is shown, not changed.
Groups that decide roles in this app (Settings → Sign-in) are marked and ask
first. Audited with who was put in and taken out.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-01 00:49:43 +01:00
1 parent 3618cb3ae8
commit 6c5a5f0bd6
10 files changed
+794 -9

No files matched your search

+17
View File
@@ -1764,6 +1764,21 @@ export interface AuthentikGroup {
admin: boolean;
}
/** A group with who is in it, and the role it decides in this app, if any (Settings → Sign-in). */
export interface AuthentikGroupDetail extends AuthentikGroup {
/** User ids; null when Authentik did not say, and then they are not changed from here. */
members: number[] | null;
decidesRole: "admin" | "operator" | null;
}
/** A person to name a group's members by. */
export interface AuthentikGroupPerson {
pk: number;
username: string;
name: string;
active: boolean;
}
export interface AuthentikNewUser {
username: string;
name: string;
@@ -3428,6 +3443,8 @@ export const api = {
createUser: (id: number, body: AuthentikNewUser) => request<AuthentikUserMade>(`/api/authentik/${id}/users`, { method: "POST", body: JSON.stringify(body) }),
users: (id: number, search = "") => request<{ users: AuthentikPerson[]; more: boolean; self: number | null }>(`/api/authentik/${id}/users${search.trim() ? `?search=${encodeURIComponent(search.trim())}` : ""}`),
setUserActive: (id: number, pk: number, active: boolean) => request<{ user: AuthentikPerson }>(`/api/authentik/${id}/users/${pk}/active`, { method: "POST", body: JSON.stringify({ active }) }),
groupDetails: (id: number) => request<{ groups: AuthentikGroupDetail[]; people: AuthentikGroupPerson[]; more: boolean; self: number | null }>(`/api/authentik/${id}/group-details`),
updateGroup: (id: number, gid: string, body: { name?: string; membersAdd?: number[]; membersRemove?: number[] }) => request<{ changed: string[]; added: number; removed: number }>(`/api/authentik/${id}/groups/${gid}`, { method: "PATCH", body: JSON.stringify(body) }),
updateUser: (id: number, pk: number, body: { name?: string; email?: string; groupsAdd?: string[]; groupsRemove?: string[] }) => request<{ user: AuthentikPerson; changed: string[] }>(`/api/authentik/${id}/users/${pk}`, { method: "PATCH", body: JSON.stringify(body) }),
deleteUser: (id: number, pk: number, username: string) => request<void>(`/api/authentik/${id}/users/${pk}`, { method: "DELETE", body: JSON.stringify({ username }) }),
removeWriteToken: (id: number) => request<void>(`/api/authentik/${id}/write-token`, { method: "DELETE" }),