## What & why S-15a, the first of the S-15 (#16) split. A new **beheer** portal (medewerker realm, like behandel) shows the ZTC catalogus — the published zaaktypen — **read-only**. A beheerder logs in and sees the seeded BIG-REGISTRATIE zaaktype. Closes #130 ### The vertical portal → BFF `GET /beheer/catalogi/zaaktypen` (medewerker realm + `beheerder` role) → ACL `GET /catalogi/zaaktypen` → ZGW Catalogi API. - **ACL**: new read-only `GET /catalogi/zaaktypen` listing published zaaktypen (reuses the ADR-0021 Catalogi client; public-safe `identificatie`/`omschrijving`). - **BFF**: new typed `IAclClient` + `Downstream:Acl:BaseUrl`, and `GET /beheer/catalogi/zaaktypen` behind a new `beheerder` policy (reuses the medewerker bearer scheme + realm-role lifting). OpenAPI spec + generated Angular client regenerated. - **Keycloak**: `beheerder` realm role + `bram-beheerder` test user in the medewerker realm. - **Frontend**: new `apps/beheer` Angular app (copied from behandel) with a read-only catalogus page; `SECURE_API_ROUTES=['/beheer/']`. - **Infra**: `beheer` compose service (port 8143), added to `WAIT_SVCS` + CI log-dump; a Playwright e2e (beheerder login → catalogus shows BIG-REGISTRATIE). ### New boundary → ADR-0025 The BFF now reaches the **ACL directly** for the catalogus read — a new service-to-service edge (§14). The catalogus is neither a domain nor a projection concern, and §8.1 means only the ACL may read ZGW; routing through the domain would pollute it with a non-domain passthrough. §8.1/§8.3 stay intact. Recorded in **ADR-0025**. ## Definition of Done - [x] Failing test committed before each implementation (red→green per layer: ACL, BFF, frontend). - [x] Conventional Commits referencing #130. - [ ] CI green — pending Gitea Actions run. - [x] `docker compose up` brings up `beheer` (health-gated in `WAIT_SVCS`). - [x] Docs — ADR-0025 + demo-script S-15a note. - [x] Demo note in `docs/demo-script.md`. ## Verified locally lint (`dotnet format`) ✓ · .NET unit (Acl 57 / Big 152 / EventSubscriber 19 / Bff 40) ✓ · frontend lint+test (8 projects) ✓ · frontend build (4 apps) ✓. Mutation ratchet: added a gateway unit test for the new `ListZaaktypenAsync` mapping so the ACL score holds. verify-stack (compose smoke + e2e) runs in CI. ## Notes for reviewers - The BFF drops the ZGW URL from `BeheerZaaktype` (public-safe: identificatie + omschrijving only). - The catalogus e2e asserts on the stable seeded `BIG-REGISTRATIE` (not a per-test reference), safe on the shared verify stack. - Follow-ups: **S-15b** (#131) default-fill CRUD, **S-15c** (#132) medewerker-realm MFA. 🤖 Generated with [Claude Code](https://claude.com/claude-code)Reviewed-on: #133
76 lines
2.7 KiB
TypeScript
76 lines
2.7 KiB
TypeScript
import { signal } from '@angular/core';
|
|
import { render, screen } from '@testing-library/angular';
|
|
import { of, throwError } from 'rxjs';
|
|
import { BeheerZaaktype, BffApiV1Service } from 'api-client';
|
|
import { AuthService } from 'auth';
|
|
import { axe } from 'vitest-axe';
|
|
import { CatalogusPage } from './catalogus-page';
|
|
|
|
const sample: BeheerZaaktype[] = [
|
|
{ identificatie: 'BIG-REGISTRATIE', omschrijving: 'BIG-registratie' },
|
|
{ identificatie: 'BIG-HERREGISTRATIE', omschrijving: 'BIG-herregistratie' },
|
|
];
|
|
|
|
class FakeAuth extends AuthService {
|
|
readonly isAuthenticated = signal(true);
|
|
readonly bsn = signal<string | undefined>(undefined);
|
|
override readonly roles = signal<readonly string[]>(['beheerder']);
|
|
login(): void {
|
|
/* not exercised here */
|
|
}
|
|
logout(): void {
|
|
/* not exercised here */
|
|
}
|
|
}
|
|
|
|
function setup(overrides: { getBeheerCatalogiZaaktypen?: ReturnType<typeof vi.fn> } = {}) {
|
|
const getBeheerCatalogiZaaktypen =
|
|
overrides.getBeheerCatalogiZaaktypen ?? vi.fn().mockReturnValue(of(sample));
|
|
return {
|
|
getBeheerCatalogiZaaktypen,
|
|
providers: [
|
|
{ provide: BffApiV1Service, useValue: { getBeheerCatalogiZaaktypen } },
|
|
{ provide: AuthService, useClass: FakeAuth },
|
|
],
|
|
};
|
|
}
|
|
|
|
describe('CatalogusPage', () => {
|
|
it('lists the published zaaktypen on open', async () => {
|
|
const { getBeheerCatalogiZaaktypen, providers } = setup();
|
|
await render(CatalogusPage, { providers });
|
|
|
|
expect(getBeheerCatalogiZaaktypen).toHaveBeenCalled();
|
|
expect(await screen.findByText('BIG-REGISTRATIE')).toBeTruthy();
|
|
expect(screen.getByText('BIG-registratie')).toBeTruthy();
|
|
expect(screen.getByText('BIG-HERREGISTRATIE')).toBeTruthy();
|
|
});
|
|
|
|
it('shows an empty state when the catalogus has no published zaaktypen', async () => {
|
|
const { providers } = setup({ getBeheerCatalogiZaaktypen: vi.fn().mockReturnValue(of([])) });
|
|
await render(CatalogusPage, { providers });
|
|
|
|
expect(await screen.findByText(/geen gepubliceerde zaaktypen/i)).toBeTruthy();
|
|
});
|
|
|
|
it('surfaces a load failure instead of swallowing it', async () => {
|
|
const { providers } = setup({
|
|
getBeheerCatalogiZaaktypen: vi.fn().mockReturnValue(throwError(() => new Error('403'))),
|
|
});
|
|
await render(CatalogusPage, { providers });
|
|
|
|
expect(await screen.findByText(/kon de catalogus niet laden/i)).toBeTruthy();
|
|
});
|
|
|
|
it('has no WCAG 2.1 AA violations', async () => {
|
|
document.documentElement.lang = 'nl';
|
|
const { container } = await render(CatalogusPage, { providers: setup().providers });
|
|
|
|
const results = await axe(container, {
|
|
runOnly: { type: 'tag', values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'] },
|
|
});
|
|
|
|
expect(results.violations).toEqual([]);
|
|
});
|
|
});
|