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:
@@ -20,3 +20,36 @@ export async function zielAuswahl() {
|
||||
}
|
||||
|
||||
export type ZielAuswahl = Awaited<ReturnType<typeof zielAuswahl>>;
|
||||
|
||||
/** Was sshkv auf einem Host verwaltet (#016): Public Keys direkt und ueber Gruppen. */
|
||||
export async function verwendungenAufHost(hostId: string) {
|
||||
const [oeffentlich, privat] = await Promise.all([
|
||||
prisma.publicVerwendung.findMany({
|
||||
where: {
|
||||
zustand: { not: "ENTFERNT" },
|
||||
OR: [{ hostId }, { hostgruppe: { mitglieder: { some: { hostId } } } }],
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
zielbenutzer: true,
|
||||
optionen: true,
|
||||
zustand: true,
|
||||
hostgruppe: { select: { name: true } },
|
||||
schluessel: { select: { id: true, name: true, typ: true, fingerprint: true } },
|
||||
},
|
||||
orderBy: [{ zielbenutzer: "asc" }, { angelegtAm: "asc" }],
|
||||
}),
|
||||
prisma.privateVerwendung.findMany({
|
||||
where: { hostId, zustand: { not: "ENTFERNT" } },
|
||||
select: {
|
||||
id: true,
|
||||
zielbenutzer: true,
|
||||
pfad: true,
|
||||
zustand: true,
|
||||
schluessel: { select: { id: true, name: true, typ: true, fingerprint: true } },
|
||||
},
|
||||
orderBy: [{ zielbenutzer: "asc" }, { pfad: "asc" }],
|
||||
}),
|
||||
]);
|
||||
return { oeffentlich, privat };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user