feat(openzaak): per-document-type confidentialiteit config (WP-59)
Drives the DRC upload's vertrouwelijkheidaanduiding from a new stamdata table instead of the hardcoded "openbaar", following the existing config-as-code pattern (ADR-0004). Adds the referential-integrity check StamdataValidationTests was missing for the new table.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
|
||||
using BigRegister.Api.Contracts;
|
||||
using BigRegister.Api.Data;
|
||||
using BigRegister.Domain.Authorization;
|
||||
using BigRegister.Stamdata;
|
||||
|
||||
namespace BigRegister.Api.Zgw;
|
||||
|
||||
@@ -23,6 +24,15 @@ public sealed class OpenZaakDocumentSource(HttpClient http, ZgwTokenProvider tok
|
||||
{
|
||||
private readonly ZgwHttpClient zgw = new(http, tokens);
|
||||
|
||||
// WP-59: per-document-type confidentiality (stamdata, ADR-0004) — "openbaar" if the
|
||||
// category isn't in the table, so an unconfigured category never fails the upload.
|
||||
private static readonly IReadOnlyDictionary<string, string> ConfidentialiteitByCategory =
|
||||
StamdataFile.Load<DocumentConfidentialiteit>("documentconfidentialiteit")
|
||||
.ToDictionary(r => r.CategoryId, r => r.Vertrouwelijkheidaanduiding);
|
||||
|
||||
private static string ConfidentialiteitFor(string categoryId) =>
|
||||
ConfidentialiteitByCategory.GetValueOrDefault(categoryId, "openbaar");
|
||||
|
||||
// ponytail: sync-over-async — IDocumentSource is sync to match the local store + the
|
||||
// existing sync upload/submit endpoints, same reasoning as OpenZaakZaakSource.
|
||||
public UploadResponse Upload(
|
||||
@@ -52,10 +62,7 @@ public sealed class OpenZaakDocumentSource(HttpClient http, ZgwTokenProvider tok
|
||||
Inhoud: Convert.ToBase64String(content),
|
||||
Informatieobjecttype: informatieobjecttypeUrl,
|
||||
Identificatie: doc.DocumentId,
|
||||
// ponytail: hardcoded "openbaar" (public) — real usage would likely vary the
|
||||
// confidentiality level per category (e.g. an identity document is more sensitive
|
||||
// than a diploma); a fixed value is enough to prove the seam end-to-end.
|
||||
Vertrouwelijkheidaanduiding: "openbaar"), caller);
|
||||
Vertrouwelijkheidaanduiding: ConfidentialiteitFor(categoryId)), caller);
|
||||
|
||||
DocumentStore.SetDrcUrl(doc.DocumentId, eio.Url);
|
||||
return new UploadResponse(doc.DocumentId, doc.LocalId);
|
||||
|
||||
Reference in New Issue
Block a user