From 6ab495ad3e47a1b78f32903e421640bd8cbf0cc3 Mon Sep 17 00:00:00 2001 From: ngqile Date: Fri, 27 Nov 2026 15:59:38 +0800 Subject: [PATCH] docs(openspec): enforce the second module with @AdminModule(also) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- openspec/changes/add-lead-listing-export/design.md | 12 ++++++------ openspec/changes/add-lead-listing-export/tasks.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openspec/changes/add-lead-listing-export/design.md b/openspec/changes/add-lead-listing-export/design.md index efb0727..6da8cdc 100644 --- a/openspec/changes/add-lead-listing-export/design.md +++ b/openspec/changes/add-lead-listing-export/design.md @@ -93,14 +93,14 @@ See proposal.md for why. |---|---| | `GET /api/admin/leads?q&page&size` | `BO_LEADS` | | `GET /api/admin/leads/{leadUuid}` | `BO_LEADS` | -| `PUT /api/admin/leads/{leadUuid}` | `BO_LEADS_EDIT` | -| `GET /api/admin/leads/export?q` | `BO_LEADS_EXPORT` | +| `PUT /api/admin/leads/{leadUuid}` | `BO_LEADS_EDIT` and `BO_LEADS` | +| `GET /api/admin/leads/export?q` | `BO_LEADS_EXPORT` and `BO_LEADS` | -**Second check in code:** `@AdminModule` is any-of, so two handlers re-check a module with `AdminModuleAccess.grantedAny`, which gives 403 `FORBIDDEN` when it fails: -- the update handler also checks `BO_LEADS`; -- the export handler also checks `BO_LEADS`. +**Second required module:** `@AdminModule` is any-of. It gains an attribute `String[] also() default {}`: `AppAccessAspect` additionally requires every module listed in `also`, each checked with `AdminModuleAccess.grantedAny`, failing closed. Super admin still passes, and the injected `ROLE_ADMIN` still grants nothing. This keeps the rule in the one place that already knows the caller's roles, rather than copying it into handlers. +- The update handler is `@AdminModule(value = "BO_LEADS_EDIT", also = "BO_LEADS")`. +- The Lead Listing export handler is `@AdminModule(value = "BO_LEADS_EXPORT", also = "BO_LEADS")`. -**Event leads export:** `GET /api/admin/event-leads/{eventUuid}/export?<4a filters>` carries `@AdminModule("BO_LEADS_EXPORT")` and re-checks `BO_EVENT_LEADS` in code. +**Event leads export:** `GET /api/admin/event-leads/{eventUuid}/export?<4a filters>` is `@AdminModule(value = "BO_LEADS_EXPORT", also = "BO_EVENT_LEADS")`. **Listing rows:** - Uuids are strings. diff --git a/openspec/changes/add-lead-listing-export/tasks.md b/openspec/changes/add-lead-listing-export/tasks.md index 8899d1d..dfb2019 100644 --- a/openspec/changes/add-lead-listing-export/tasks.md +++ b/openspec/changes/add-lead-listing-export/tasks.md @@ -44,7 +44,7 @@ Design: `design.md` (decision numbers below refer to it). All tasks run serially Tests first: - each validation code, with update normalisation the same as capture; - the digits key built from `012-345 6701` and from `+60 12-345 6701`; - - the update is refused 403 without `BO_LEADS`, even with `BO_LEADS_EDIT`; + - `@AdminModule(also=…)` in `AppAccessAspect`: missing an `also` module gives 403, super admin passes, injected `ROLE_ADMIN` grants nothing; the update is refused 403 without `BO_LEADS`, even with `BO_LEADS_EDIT`; - uuids are strings; - the latest salesperson and history names are resolved once per request.