Edit Authentik users: name, email and groups

Each person in Apps → Authentik → Users gets an Edit form. The user name is
shown but not changeable. Authentik is sent only what differs, and groups as
what goes in and what comes out on top of the user's current groups, so a
membership added meanwhile is kept; a user whose groups Authentik doesn't
report can't have them changed. The server refuses service accounts, the
token's own account, and an edit that would leave no active administrator.
Audited by field name, never by value.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-01 00:39:51 +01:00
1 parent 0cd11268ee
commit 3618cb3ae8
9 files changed
+370 -30

No files matched your search

+3
View File
@@ -1781,6 +1781,8 @@ export interface AuthentikPerson {
/** May do everything in Authentik. */
admin: boolean;
lastLogin: string | null;
/** Group ids; null when Authentik did not say, and then they are not changed from here. */
groups: string[] | null;
}
/** A user Authentik made, and the one-time link for them to choose a password with (null, with the reason, when that could not be made). */
@@ -3426,6 +3428,7 @@ 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 }) }),
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" }),
},