Rollen Chunk 7: Benutzerverwaltung und Sicherung strikt Admin-only
Docker Image / test (push) Canceled after 0s
Docker Image / image (push) Canceled after 0s

This commit is contained in:
loki committed 2026-10-11 20:35:56 +02:00
1 parent 71dca44c1d
commit 601cbacea7
1 file changed
+39
+39
View File
@@ -272,3 +272,42 @@ export function decideVacation(
body: JSON.stringify({ action }),
});
}
export interface ManagedUser {
id: string;
name: string;
email: string;
role: "admin" | "teamleiter" | "benutzer";
}
export function listUsers(): Promise<{ users: ManagedUser[] }> {
return request("/api/users");
}
export function createUser(input: {
name: string;
email: string;
password: string;
role: "admin" | "teamleiter" | "benutzer";
}): Promise<{ user: ManagedUser }> {
return request("/api/users", {
method: "POST",
body: JSON.stringify(input),
});
}
export function setUserRole(
id: string,
role: "admin" | "teamleiter" | "benutzer",
): Promise<{ user: { id: string; role: string } }> {
return request(`/api/users/${encodeURIComponent(id)}`, {
method: "PUT",
body: JSON.stringify({ role }),
});
}
export function deleteUser(id: string): Promise<{ deleted: boolean }> {
return request(`/api/users/${encodeURIComponent(id)}`, {
method: "DELETE",
});
}