|
16 | 16 | // - the self-registration grant (`sys_user_permission_set`) settles on the |
17 | 17 | // self-registrant's FIRST MEMBERSHIP, owned by that membership's |
18 | 18 | // organization (ADR-0131 D3) — never at sign-up, when there is no |
19 | | -// organization yet; the invitee is admitted by the invitation, not by the |
20 | | -// open posture, and is owed no declared set; |
| 19 | +// organization yet; the invitee is admitted by the open posture, |
| 20 | +// invitation or not, so its declared set settles on its first membership |
| 21 | +// too, the organization whose invitation it accepted; |
21 | 22 | // - the activity writer (`sys_activity`) stamps the organization of the |
22 | 23 | // record it is about, and writes NO row about a record that has none |
23 | 24 | // (ADR-0131 D9; ruling of record 6257510973 item 3, Q3 A); |
@@ -212,11 +213,13 @@ for (const posture of ['group', 'isolated'] as const) { |
212 | 213 | // The creator's `organization_admin` (the auto org-admin grant) rides |
213 | 214 | // the same membership; every grant names the organization. |
214 | 215 | expect(grants.filter((g: Row) => g.organization_id !== orgId), 'grants outside the organization').toEqual([]); |
215 | | - // The invitee was admitted by the invitation, not by the open posture, so |
216 | | - // is owed no declared set (`decideAudienceAdmission`); whatever it holds |
217 | | - // names the organization too. |
| 216 | + // The open posture admits the invitee by its own rule, invitation or not, |
| 217 | + // so it is owed the declared set like the registrant |
| 218 | + // (`decideAudienceAdmission`); the grant settles on its first membership, |
| 219 | + // the organization whose invitation it accepted, and every grant it |
| 220 | + // holds names that organization. |
218 | 221 | const inviteeGrants = await ql.find('sys_user_permission_set', { where: { user_id: inviteeId }, ...SYS }); |
219 | | - expect(inviteeGrants.filter((g: Row) => g.permission_set === SET), 'the invitee holds no declared grant').toEqual([]); |
| 222 | + expect(inviteeGrants.filter((g: Row) => g.permission_set === SET).map((g: Row) => g.organization_id), 'the invitee\'s declared grant').toEqual([orgId]); |
220 | 223 | expect(inviteeGrants.filter((g: Row) => g.organization_id !== orgId), 'invitee grants outside the organization').toEqual([]); |
221 | 224 | }); |
222 | 225 |
|
|
0 commit comments