@@ -153,32 +153,54 @@ export interface PositionGrantSummary {
153153}
154154
155155/**
156- * How a permission set reaches a user, in {@link EffectivePermissionSet}:
156+ * How a permission set reaches a user, in {@link EffectivePermissionSet}. One
157+ * kind per channel through which the resolver enforcement uses
158+ * (`resolveUserAuthzGrants` in `@objectstack/core`, joined with the security
159+ * service's human baseline) names a set for a user:
157160 *
161+ * - `direct` — one of the user's own `sys_user_permission_set` grant rows
162+ * names it.
163+ * - `position` — the definition of a position the user holds names it in
164+ * `permissionSets` (ADR-0131 D3/D4); `position` is that position's name. A
165+ * built-in identity position's static binding is such a definition too: an
166+ * external member's `external_default` is reported with
167+ * `{ kind: 'position', position: 'org_external' }`. `everyone` is never
168+ * reported here: its bindings are `default`.
158169 * - `default` — a default binding: the set is bound to the `everyone`
159170 * audience anchor (the deployment baseline, an app's `isDefault` set, an
160171 * accepted package default; ADR-0090 D5), or it is the human baseline the
161- * resolution adds for every authenticated member (`external_default` for an
162- * external member).
163- * - `position` — the definition of a position the user holds names it in
164- * `permissionSets` (ADR-0131 D3/D4); `position` is that position's name.
165- * `everyone` is never reported here: its bindings are `default`.
166- * - `direct` — one of the user's own `sys_user_permission_set` grant rows
167- * names it.
172+ * security service adds for every authenticated member (`external_default`
173+ * for an external member, so that set carries both its `position` and its
174+ * `default` origin).
175+ * - `derived` — the resolver confers the name from the user's standing, with
176+ * no grant row and no position definition naming it. `source` says which
177+ * standing, and the vocabulary is closed:
178+ * - `platform_admin_config` — the user's own stored email matches the
179+ * deployment's configured platform administrators
180+ * (`OS_PLATFORM_OWNER_EMAIL`), which confers `admin_full_access` and
181+ * platform-admin standing (on a walled tenancy posture, the only anchor
182+ * of that standing);
183+ * - `ai_access` — the user's `sys_user.ai_access` flag is set, which
184+ * confers the `ai_seat` capability name.
185+ *
186+ * Only the user's own resolution is described: the sets an API key's scopes,
187+ * an agent's ceiling or the anonymous `guest` anchor confer belong to a
188+ * credential or principal kind, not to the user, and are not origins.
168189 */
169190export type EffectivePermissionSetOrigin =
170- | { kind : 'default ' }
191+ | { kind : 'direct ' }
171192 | { kind : 'position' ; position : string }
172- | { kind : 'direct' } ;
193+ | { kind : 'default' }
194+ | { kind : 'derived' ; source : 'platform_admin_config' | 'ai_access' } ;
173195
174196/** One permission set in {@link EffectiveAccess}. */
175197export interface EffectivePermissionSet {
176198 /** The permission set's machine name. */
177199 name : string ;
178200 /**
179201 * Every way the set reaches the user, at least one. A set reached two ways
180- * is listed once, with both origins (a direct grant and a position, or two
181- * positions).
202+ * is listed once, with both origins (a direct grant and a position, two
203+ * positions, or a grant row and the configured platform administrator ).
182204 */
183205 origins : EffectivePermissionSetOrigin [ ] ;
184206}
@@ -192,9 +214,26 @@ export interface EffectiveAccess {
192214 * vetted for the described user as `explain` vets it. `null` with none.
193215 */
194216 organizationId : string | null ;
195- /** The positions the user holds there, in force (the resolver's `positions`). */
217+ /**
218+ * The positions the user holds there, in force, exactly as the resolver
219+ * lists them: the derived `platform_admin` first where it is held, then the
220+ * positions projected from the user's membership (`org_owner`, `org_admin`,
221+ * `org_member`, `org_external`) and the user's own position rows, then the
222+ * `everyone` audience anchor for every member who is not external. A position
223+ * the activation ledger switched off is not listed. `everyone` and
224+ * `platform_admin` are listed although neither is ever an origin
225+ * (`everyone`'s bindings are `default`; `platform_admin` names no set).
226+ */
196227 positions : string [ ] ;
197- /** The permission sets in force for the user there, in resolution order. */
228+ /**
229+ * The permission sets in force for the user there, each once, in the
230+ * resolver's order: the sets of the user's grant rows in grant order, then
231+ * the position-bound sets in the order the held positions name them, then
232+ * the `derived` names (`admin_full_access` from the configured platform
233+ * administrators, then `ai_seat`), then the human baseline sets the
234+ * security service adds. A set already listed keeps its first place and
235+ * gains the later origin.
236+ */
198237 permissionSets : EffectivePermissionSet [ ] ;
199238}
200239
@@ -1249,8 +1288,11 @@ export interface ISecurityService {
12491288 * Gated as `explain` is: describing someone else requires `manage_users`,
12501289 * organization administration of an organization that user is a member of,
12511290 * or a delegated `adminScope` covering that user. A user who does not exist
1252- * is refused exactly as one the caller may not manage, so the answer says
1253- * nothing about which ids exist.
1291+ * is refused exactly as one the caller may not manage, for every caller, so
1292+ * the answer says nothing about which ids exist. This is where it departs
1293+ * from `explain`, which answers an admitted caller `404` for an id with no
1294+ * user row: an implementation sharing explain's gate must not carry that
1295+ * `404` over.
12541296 *
12551297 * **OPTIONAL, and absence is a defined state.** A security service that
12561298 * predates it omits it; callers feature-detect
0 commit comments