feat: synchronize governance templates in bulk

This commit is contained in:
2026-08-20 19:47:02 +02:00
parent 935cee8ccd
commit 550c14b92e
9 changed files with 550 additions and 41 deletions
+32
View File
@@ -575,6 +575,27 @@ export type GovernanceTemplateItem = {
updated_at: string;
};
export type GovernanceSynchronizationOutcome = {
assignment_id: string;
template_id: string;
tenant_id: string;
kind: "group" | "role";
operation: "upsert" | "remove";
status: "created" | "updated" | "unchanged" | "removed" | "absent" | "blocked" | "failed";
resource_id?: string | null;
blocker_codes: string[];
message?: string | null;
provenance: Record<string, string>;
};
export type GovernanceSynchronizationResponse = {
version: "1";
operation_id: string;
dry_run: boolean;
outcomes: GovernanceSynchronizationOutcome[];
counts: Record<string, number>;
};
export type DataSubjectSelector = {
account_id?: string | null;
identity_id?: string | null;
@@ -819,6 +840,17 @@ export function deleteGovernanceTemplate(settings: ApiSettings, templateId: stri
return apiFetch(settings, apiPath(`/api/v1/admin/system/governance-templates/${templateId}`, { change_request_id: changeRequestId }), { method: "DELETE" });
}
export function synchronizeGovernanceTemplates(
settings: ApiSettings,
templateIds: string[],
dryRun = false
): Promise<GovernanceSynchronizationResponse> {
return apiFetch(settings, "/api/v1/admin/system/governance-templates/synchronize", {
method: "POST",
body: JSON.stringify({ template_ids: templateIds, dry_run: dryRun })
});
}
export async function fetchDataSubjectRequests(settings: ApiSettings): Promise<DataSubjectRequestSummary[]> {
const response = await apiFetch<{ items: DataSubjectRequestSummary[] }>(settings, "/api/v1/admin/privacy/data-subject-requests");
return response.items;