feat(hosts): Schluessel auf dem Host anzeigen und ausrollen (#016)

Die Hostseite listet, welche Public und Private Keys sshkv dort
verwaltet - direkt oder ueber eine Hostgruppe - mit Zustand als Punkt
und Text. Ein Dry-Run je Host zeigt das Diff aller Benutzer dieses
Hosts und rollt nach Bestaetigung aus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 10:19:27 +02:00
co-authored by Claude Opus 5.5
parent f66d87ad11
commit 30f271b23a
7 changed files with 151 additions and 13 deletions
+12 -1
View File
@@ -100,11 +100,20 @@ export type Ziel = { readonly hostId: string; readonly zielbenutzer: string };
export async function zieleVonVerwendungen(where: {
schluesselId?: string;
ids?: string[];
hostId?: string;
}): Promise<Ziel[]> {
const verwendungen = await prisma.publicVerwendung.findMany({
where: {
...(where.schluesselId ? { schluesselId: where.schluesselId } : {}),
...(where.ids ? { id: { in: where.ids } } : {}),
...(where.hostId
? {
OR: [
{ hostId: where.hostId },
{ hostgruppe: { mitglieder: { some: { hostId: where.hostId } } } },
],
}
: {}),
zustand: { not: "ENTFERNT" },
},
select: {
@@ -117,9 +126,11 @@ export async function zieleVonVerwendungen(where: {
});
const ziele = new Map<string, Ziel>();
for (const verwendung of verwendungen) {
const hostIds = verwendung.hostId
const alleHostIds = verwendung.hostId
? [verwendung.hostId]
: (verwendung.hostgruppe?.mitglieder.filter((m) => !m.host.archiviertAm).map((m) => m.hostId) ?? []);
// Bei der Auswahl nach Host nur diesen Host, auch wenn die Verwendung an einer Gruppe haengt.
const hostIds = where.hostId ? alleHostIds.filter((id) => id === where.hostId) : alleHostIds;
for (const hostId of hostIds) {
ziele.set(`${hostId}\u0000${verwendung.zielbenutzer}`, {
hostId,