Implement US-14 assigned professional read access
This commit is contained in:
1 parent
0ce9b2b168
commit
5996481081
11 files changed
+441
-24
No files matched your search
+59
-3
@@ -81,9 +81,9 @@ API to obtain the actual patient, then compares that owner with the account's
|
||||
profile. Requests for another patient's information receive an empty `404`, the
|
||||
same as missing data, without forwarding writes or revealing existence. Failed
|
||||
ownership lookups fail closed with `502`/`504`. Tokens do not cache ownership.
|
||||
Healthcare-professional logins establish a trusted role, but their access is denied
|
||||
by default until US-14's assigned-patient read policies are implemented; US-14 is
|
||||
not completed by this change. Trend/overview endpoints remain unimplemented; the
|
||||
Healthcare-professional logins establish a trusted role. US-14 now permits reads
|
||||
of assigned patients and the caller’s own assignment list; all professional writes
|
||||
are rejected before forwarding. Trend/overview endpoints remain unimplemented; the
|
||||
gateway's default authentication policy also protects future patient endpoints,
|
||||
which must retain ownership checks when added.
|
||||
|
||||
@@ -128,3 +128,59 @@ than a production authentication bypass.
|
||||
|
||||
Framework reference:
|
||||
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.authentication.bearertoken.bearertokenoptions?view=aspnetcore-10.0
|
||||
|
||||
## US-14 professional assignments
|
||||
|
||||
Predefine assignments in the gateway's external `Access:ProfessionalAssignments`
|
||||
configuration, keyed by the stable professional account identifier. For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"Access": {
|
||||
"ProfessionalAssignments": {
|
||||
"example_professional": [
|
||||
"00000000-0000-0000-0000-000000000001",
|
||||
"00000000-0000-0000-0000-000000000002"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use actual patient identifiers returned by authenticated profile creation. The
|
||||
example UUIDs are placeholders. A professional can have several patients, and
|
||||
several professionals can share a patient. Duplicate identifiers are treated as
|
||||
one assignment. Empty identifiers are rejected at startup. An omitted account
|
||||
entry means no assignments. Configure that account's role and password hash
|
||||
separately under `Authentication:Accounts`; assignments never grant a role.
|
||||
|
||||
`GET /api/professionals/me/patients` requires the HealthcareProfessional policy and
|
||||
returns an array of `{ "patientId": "..." }` entries, in deterministic identifier
|
||||
order. It lists only the caller's configured assignments, without fetching patient
|
||||
records. No assignments returns `[]`. Missing profiles remain assigned identifiers;
|
||||
retrieving their data follows the existing missing-resource behaviour. Caller
|
||||
query parameters or identity headers cannot select another professional's list.
|
||||
Patient accounts cannot use this endpoint.
|
||||
|
||||
Professional GET requests to existing patient profiles, observations (including
|
||||
recorded legacy context), history, latest observations and numerical insight
|
||||
require membership in the caller's assignment set. Observation-ID requests resolve
|
||||
the actual owning patient via the protected Observation API; a supplied patient ID
|
||||
is not evidence of assignment. Unassigned reads return an empty `404`, preserving
|
||||
the same non-disclosure convention as patient access. Assigned missing data follows
|
||||
the existing retrieval contracts. All professional POST/PUT/PATCH/DELETE requests
|
||||
are rejected with `403` before ownership lookups or forwarding. There is no
|
||||
assignment-management API or additional database/service.
|
||||
|
||||
Assignments are loaded at gateway startup, outside tokens and credential
|
||||
validation. Restart the gateway after changing its external configuration. Existing
|
||||
valid tokens then use the new assignment data. Empty lists need no upstream service;
|
||||
observation-owner lookup failures fail closed with `502`/`504`.
|
||||
|
||||
The US-14 tests exercise actual login, multiple and shared assignments, empty lists,
|
||||
assigned/unassigned reads, preserved context, missing resources, every existing
|
||||
write route, invalid and expired credentials, patient-role rejection, assignment
|
||||
changes across restart and unavailable ownership lookup. Trend and overview
|
||||
endpoints are still absent: their read routing and integration tests must be added
|
||||
with US-11/US-12. Structured context remains work under US-04–US-08; professional
|
||||
access already applies to whatever observation context those APIs expose.
|
||||
Reference in new issue
Block a user