mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
feat(sharing): name a record's owner in full to whoever they share with
The switcher and the banner named a shared record's owner by their greeting name — the value they typed at onboarding for "how should HealthLog address you". When an owner has set a full name, that is what a delegate should see: entering somebody's record, you read whose it is by who they are. - the account-access resolver publishes the owner's `fullName` alongside the greeting name and the username - `accountLabel` prefers fullName, then displayName, then username. Optional on the argument so the grant-view and actor shapes that never carried it keep the old two-field behaviour untouched - the closed presentation schema carries `fullName` and its parity matcher compares it, so the two published views of the active record cannot name the same owner differently - the OpenAPI contract regenerates with the additive field This deliberately discloses the owner's full name to every delegate, read-only included — it was patient-identity data behind a MANAGE-gated export until now. That is the intended behaviour, documented at `accountLabel` so it is not mistaken for a leak and tightened back. The resolver, the schema parity, the label fallback and a read-only delegate's banner are each pinned by a test.
This commit is contained in:
1 parent
73ea1b03f3
commit
e33700c7a9
20 files changed
+202
-13
No files matched your search
@@ -36,6 +36,7 @@ const OWNER = {
|
||||
accountId: "acct-owner",
|
||||
username: "owner",
|
||||
displayName: "Margarethe",
|
||||
fullName: null,
|
||||
access: "read" as const,
|
||||
level: "read" as const,
|
||||
sections: null,
|
||||
|
||||
@@ -7,6 +7,7 @@ const OWNER = {
|
||||
accountId: "acct-owner",
|
||||
username: "owner",
|
||||
displayName: "Margarethe",
|
||||
fullName: null,
|
||||
access: "write" as const,
|
||||
level: "write" as const,
|
||||
sections: null,
|
||||
|
||||
@@ -132,6 +132,7 @@ const OWNER_READ: AccountAccessEntry = {
|
||||
accountId: "acct-owner",
|
||||
username: "grandma",
|
||||
displayName: "Margarethe",
|
||||
fullName: null,
|
||||
access: "read" as const,
|
||||
level: "read" as const,
|
||||
sections: null,
|
||||
@@ -148,6 +149,7 @@ const MANAGED_GUARDIAN: AccountAccessEntry = {
|
||||
accountId: "managed-record",
|
||||
username: "managed-record",
|
||||
displayName: "Managed profile",
|
||||
fullName: null,
|
||||
access: "write" as const,
|
||||
level: "manage" as const,
|
||||
sections: null,
|
||||
|
||||
@@ -56,6 +56,7 @@ const OWNER = {
|
||||
accountId: "acct-owner",
|
||||
username: "grandma",
|
||||
displayName: "Margarethe",
|
||||
fullName: null,
|
||||
access: "read" as const,
|
||||
level: "read" as const,
|
||||
sections: null,
|
||||
@@ -108,6 +109,25 @@ describe("<SharedRecordBanner>", () => {
|
||||
expect(html).toContain("grandma");
|
||||
});
|
||||
|
||||
it("names the owner in full when they have a full name, to a read-only delegate", () => {
|
||||
// v1.37.2 — the banner is the account-access view that renders server-side,
|
||||
// and this OWNER is READ (`canWrite: false`). The full name leads over the
|
||||
// greeting name: a delegate about to log a reading sees whose record it is
|
||||
// as who they are, not by a nickname. A deliberate disclosure to everyone
|
||||
// shared with, read-only included (maintainer decision 2026-08-08).
|
||||
const named = {
|
||||
...OWNER,
|
||||
fullName: "Test Full Name",
|
||||
displayName: "Margarethe",
|
||||
};
|
||||
const html = render(
|
||||
{ accounts: [named], active: named, canSwitch: true },
|
||||
<SharedRecordBanner />,
|
||||
);
|
||||
expect(html).toContain('data-slot="shared-record-banner"');
|
||||
expect(html).toContain("Test Full Name");
|
||||
});
|
||||
|
||||
it("says the access is read-only, and carries the way out", () => {
|
||||
const html = render(
|
||||
{ accounts: [OWNER], active: OWNER, canSwitch: true },
|
||||
|
||||
@@ -213,6 +213,7 @@ function entry(partial: Partial<AccountAccessEntry> = {}): AccountAccessEntry {
|
||||
accountId: "p1",
|
||||
username: "managed-abc",
|
||||
displayName: "Managed record",
|
||||
fullName: null,
|
||||
access: "write",
|
||||
level: "manage",
|
||||
recordKind: "managed",
|
||||
|
||||
Reference in new issue
Block a user