## What & why S-15b, second of the S-15 (#16) split, on top of S-15a (#133). A beheerder edits the ACL's ZGW **default-fill** values from the beheer portal, and the next zaak is stamped with the new values — no restart. Closes #131 ### The vertical portal → BFF `GET/PUT /beheer/default-fill` (medewerker realm + `beheerder` role) → ACL `GET/PUT /default-fill` → a runtime-mutable in-memory store the ACL reads **per zaak**. - **ACL**: `IDefaultFillStore` / `InMemoryDefaultFillStore` (thread-safe, seeded from `Acl:Defaults`); `AclService` reads `fill.Current` per zaak (not cached at construction); `GET`/`PUT /default-fill` with required-field validation. - **BFF**: `IAclClient` gains `GetDefaultFillAsync`/`UpdateDefaultFillAsync`; `GET`/`PUT /beheer/default-fill` behind the `beheerder` policy. OpenAPI + generated client regenerated. - **Frontend**: a *Default-fill* editor page in the beheer app (load → edit → save, with saved/failure states) + nav between Catalogus and Default-fill. ### Scope decision → ADR-0026 Only the **three ZGW fill fields** (bronorganisatie, verantwoordelijke organisatie, vertrouwelijkheidaanduiding) are editable. The S-27 catalog-resolution keys stay **static config** — editing them would desync the zaaktype-URL cache (ADR-0021), and they're catalogus wiring, not "default fill". The store is **in-memory** (seeded from config): an edit reverts on restart. That's the reference-app-appropriate ceiling (no DB added to the stateless ACL); upgrade path documented. Recorded in **ADR-0026**. ## Verified locally lint (`dotnet format`) ✓ · .NET unit — acl 60 / bff 45 / domain 152 / event-subscriber 19 / acceptance 17 ✓ · frontend lint+test (8 projects) ✓ · beheer build ✓. Clean full-solution build (caught + fixed the acceptance `AclService` ctor drift). TDD red→green per layer (ACL store, ACL endpoints, BFF, frontend). ## Definition of Done - [x] Failing test committed before each implementation (red→green per layer). - [x] Conventional Commits referencing #131. - [ ] CI green — see note below. - [x] Docs: ADR-0026 + S-15b demo note. - [x] Demo note in `docs/demo-script.md`. ## Note on CI The bulk validates in the fast jobs (lint/build/unit/frontend/mutation). The **verify-stack e2e** (incl. the new `default-fill.spec.ts`) can't go green until the pre-existing **verify-stack bring-up failure on the 1.27/2.0.0 runner** is resolved (that fails on plain `main` too — unrelated to this PR). Additive change; no existing e2e touched. 🤖 Generated with [Claude Code](https://claude.com/claude-code)Reviewed-on: #138
102 lines
4.5 KiB
C#
102 lines
4.5 KiB
C#
namespace Acl.Application;
|
|
|
|
/// <summary>The ACL's single operation: open a zaak from a domain payload,
|
|
/// default-filling the ZGW-mandatory fields (ADR-0003).</summary>
|
|
public sealed class AclService(IZaakGateway gateway, IDefaultFillStore fill, IZaaktypeCatalog catalog, IClock clock)
|
|
{
|
|
public async Task<Uri> OpenZaakAsync(DomainRegistration registration, CancellationToken ct = default)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(registration);
|
|
|
|
// Read the current default-fill per zaak (not at construction), so a beheerder edit (S-15b)
|
|
// takes effect on the next zaak without a restart.
|
|
var defaults = fill.Current;
|
|
var request = new ZaakRequest(
|
|
defaults.Bronorganisatie,
|
|
defaults.VerantwoordelijkeOrganisatie,
|
|
defaults.Vertrouwelijkheidaanduiding,
|
|
await catalog.GetZaaktypeUrlAsync(ct),
|
|
clock.Today,
|
|
registration.Reference);
|
|
|
|
return await gateway.OpenZaakAsync(request, ct);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Approve a zaak: set it to the eindstatus of the BIG zaaktype (resolved by identificatie, S-27).
|
|
/// The domain hands over only the zaak URL; the ACL owns which statustype means "approved" (§8.1).
|
|
/// </summary>
|
|
public async Task ApproveZaakAsync(Uri zaakUrl, CancellationToken ct = default)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(zaakUrl);
|
|
|
|
await gateway.SetZaakToEindstatusAsync(zaakUrl, await catalog.GetZaaktypeUrlAsync(ct), clock.Today, ct);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Cancel a zaak on document-timeout expiry (S-10c): set it to the BIG zaaktype's cancellation
|
|
/// statustype + resultaat. The domain hands over only the zaak URL; the ACL owns which
|
|
/// statustype/resultaat means "cancelled" (§8.1).
|
|
/// </summary>
|
|
public async Task CancelZaakAsync(Uri zaakUrl, CancellationToken ct = default)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(zaakUrl);
|
|
|
|
await gateway.SetZaakToCancellationStatusAsync(zaakUrl, await catalog.GetZaaktypeUrlAsync(ct), clock.Today, ct);
|
|
}
|
|
|
|
/// <summary>The published zaaktypen, for the beheer catalogus viewer (S-15a). Read-only passthrough:
|
|
/// no default-fill, the ACL is simply the only code allowed to read ZGW (§8.1).</summary>
|
|
public Task<IReadOnlyList<ZaaktypeSummary>> ListZaaktypenAsync(CancellationToken ct = default) =>
|
|
gateway.ListZaaktypenAsync(ct);
|
|
|
|
/// <summary>The current default-fill settings, for the beheer config viewer (S-15b).</summary>
|
|
public DefaultFillSettings GetDefaultFill() => fill.Current;
|
|
|
|
/// <summary>Replace the default-fill settings from the beheer portal (S-15b). Takes effect on the
|
|
/// next zaak (the fill is read per zaak, not cached).</summary>
|
|
public void UpdateDefaultFill(DefaultFillSettings settings)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(settings);
|
|
fill.Update(settings);
|
|
}
|
|
|
|
/// <summary>The zaak's reference (its ZGW identificatie), for the read projection (#78).</summary>
|
|
public Task<string> GetZaakReferenceAsync(Uri zaakUrl, CancellationToken ct = default)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(zaakUrl);
|
|
|
|
return gateway.GetZaakIdentificatieAsync(zaakUrl, ct);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Store an uploaded diploma against the zaak (S-10b): default-fill the ZGW-mandatory document
|
|
/// fields (informatieobjecttype, bronorganisatie, vertrouwelijkheidaanduiding, taal, creatiedatum)
|
|
/// and hand the file to the gateway, which creates the informatieobject and relates it to the zaak.
|
|
/// The domain supplies only the zaak, the bytes, and the file's name/type (§8.1).
|
|
/// </summary>
|
|
public async Task<Uri> StoreDiplomaAsync(Uri zaakUrl, byte[] content, string fileName, string contentType, CancellationToken ct = default)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(zaakUrl);
|
|
ArgumentNullException.ThrowIfNull(content);
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(fileName);
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(contentType);
|
|
|
|
var defaults = fill.Current;
|
|
var request = new DocumentRequest(
|
|
defaults.Bronorganisatie,
|
|
await catalog.GetInformatieobjecttypeUrlAsync(ct),
|
|
defaults.Vertrouwelijkheidaanduiding,
|
|
zaakUrl,
|
|
clock.Today,
|
|
Titel: "Diploma",
|
|
Auteur: "zorgprofessional",
|
|
Taal: "nld",
|
|
Bestandsnaam: fileName,
|
|
Formaat: contentType,
|
|
Inhoud: content);
|
|
|
|
return await gateway.StoreDocumentAsync(request, ct);
|
|
}
|
|
}
|