Skip to content

Commit fb79d47

Browse files
fix(plugin-auth): Set Manager refuses only a person a SCIM directory holds (#33991)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbSUQWB2j9eHYsRcrCiq1X1C)_ Fixes #33200 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - **改了什么:** 「设置上级」(Set Manager) 现在只拒绝真正由 SCIM 目录同步的人;只通过 SSO 登录、背后没有目录的人,管理员可以照常改上级。按钮对平台管理员在每一行用户上都显示。 - **为什么改:** 托管环境里第一次通过平台 SSO 登录的人都会被标成 `idp_provisioned`,旧规则把他们全当成「目录持有」,登录后上级就再也改不了,按上级流转的审批跟不上组织调整。按裁决记录 6895645364 选项 A 修。 - **风险与回滚:** 只放宽:以前能成功的请求没有一个变成拒绝。SCIM 判定多读一次 `sys_scim_subject`,读失败返回 500 且不写入。回滚即 revert 本 PR。 - **先看:** `admin-set-user-manager.ts` 的 refusal 5 判断(`applyUserManagerLink`);`scim-sso-adoption.ts` 新导出的 `isHeldByScimDirectory`;`sys-user.object.ts` 的 `set_user_manager` `visible`。 - **两分钟验证:** `pnpm --filter @objectstack/plugin-auth exec vitest run src/admin-set-user-manager.test.ts`,预期 38 个全过,其中 "an SSO-only identity ... is SET like a local one" 为 200 并写入 `manager_id`。 - **需要你做的:** 无,席位落地。 ## What changes Built to the maintainer ruling recorded in 6895645364 (option A: only identities a SCIM directory holds stay locked). - **`POST /api/v1/auth/admin/set-user-manager` (refusal 5).** It refused on `sys_user.source = 'idp_provisioned'` alone. ADR-0135 D4 stamps that value on every federated link without a local password, so a person who only signs in through SSO carried it with no directory behind them. The refusal now also needs a `sys_scim_subject` row. The answer for a SCIM-held identity keeps its envelope (`403 PERMISSION_DENIED`, `details.reason: 'idp_provisioned'`), and the message says to change the manager in the directory. It no longer claims a sync would revert the value, because nothing projects the SCIM `manager` attribute onto the column today. The self, cycle, depth and cross-organization refusals are unchanged. - **One predicate, imported.** `scim-sso-adoption.ts` now exports `isHeldByScimDirectory(engine, userId)`. It is the same `sys_scim_subject` read its adoption judge already ran as condition 2, moved into an exported function. The judge calls it, and so does the endpoint. A missing `sys_scim_subject` table reads as "not held" at the endpoint. Any other read failure propagates, so the mount answers 500 and writes nothing. - **The `source` term stays a conjunct.** A SCIM-provisioned user with a local password is `env_native` under D4 and was accepted before. Requiring the SCIM row alone would have refused that user, so the endpoint still checks `source` too, and no request that was served before is refused now. - **Bulk import and demo staff.** Both run `applyUserManagerLink`, so their `manager_id` links follow the same rule with no code change. The import docblock now says who is refused. - **`sys_user.set_user_manager` visibility** is `current_user.isPlatformAdmin == true`. No column on the row says "held by SCIM", so the button is shown on every row and the endpoint refuses a SCIM-held one with its message. No new field or key. - **Lint prescription.** `os explain approval-approvers-may-resolve-empty` now says the operation refuses an identity a SCIM directory holds, and that an identity that only signs in through SSO is set like any other. The docblock in `validate-approval-approvers.ts` says the same. - **Docs.** `content/docs/automation/approvals.mdx`, `content/docs/capabilities/approvals.mdx` and `content/docs/permissions/authentication.mdx` state the narrowed refusal. - ⛔ The `idp_provisioned` stamp (ADR-0135 D4) and the password refusals are untouched. ## Tests On head `fa70eaa06`: - `admin-set-user-manager.test.ts`, refusal 5 rewritten. SCIM-held SET and CLEAR give 403 `PERMISSION_DENIED` / `idp_provisioned`, write nothing, and read `sys_scim_subject` for that user. SSO-only SET and CLEAR give 200, and `update` gets `{ id, manager_id }`. An SSO-only self-assignment is still a 400 `self_assignment`. `env_native` gives 200, also with a SCIM subject, and the SCIM table is not read. A missing table gives 200. A failed read rejects and writes nothing. - `admin-import-users-manager-pass.test.ts`: a SCIM-held row is refused with `idp_provisioned`. An SSO-only row is `linked`, and `manager_id` is written. The no-fork pin also asserts that the importer spells neither `sys_scim_subject` nor `isHeldByScimDirectory`. - `demo-staff.test.ts`: the refusal fixture is now a SCIM-held identity. - `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`: the action is offered on an `idp_provisioned` row and on the sparse face. It is hidden from a non-admin. It reads no record column, which has a positive control on the standing term. - `validate-approval-approvers.test.ts`: the new prescription is present, and the old `source 'idp_provisioned'` sentence is absent. <details><summary>Suite runs</summary> - `@objectstack/plugin-auth` full suite (locked, before the demo-staff fixture fix): 276/277 files. The one red was `demo-staff.test.ts`, whose fixture is fixed in the next commit. Re-run: `demo-staff.test.ts` + `demo-staff-provisioning.test.ts` 32/32. - Targeted: plugin-auth 3 files 76/76; platform-objects 2 files 169/169; lint 1 file 64/64. - `@objectstack/platform-objects` full: 122 files, 1994 tests passed. `@objectstack/lint` full: 212 files, 9026 tests passed. - Typecheck exit 0 for plugin-auth (all three legs, incl. `check:test-typecheck`), platform-objects and lint. - Dependent: `@objectstack/runtime` `platform-admin-action-gate.test.ts` 16/16. </details> <details><summary>Ablations (each mutation landed by ablation-replace.mjs, restored to the HEAD blob)</summary> - A1, refuse on `source` alone (the old predicate): 7 red, incl. every SSO-only pin in both endpoint and import suites. - A2, no refusal 5 at all: 4 red, incl. SCIM-held SET, CLEAR and the import row. - A3, refuse on the SCIM row alone (drop the `source` conjunct): 1 red, "env_native ... even one that owns a SCIM subject". - A4, swallow every SCIM read failure: 1 red, "a FAILED SCIM-subject read is never read as no directory". - A5, put the `record.source` term back on `visible`: 5 red across `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`. - A6, put the old lint sentence back: 1 red, "GRADES the routes". - A7, missing table rethrows: 1 red, "a missing sys_scim_subject table means no directory". </details> ## Acceptance notes - SCIM-held users stay unchangeable from both sides until the SCIM `manager` projection lands. The ruling records this and the separate card #33918 carries it. - The action's `helpText` still lists the four other refusals and not the SCIM one. The endpoint message names the directory. Changing `helpText` would move nine translation bundles, so it is left as it is. - `details.reason` keeps the value `idp_provisioned` so no client keyed on it changes. Only the predicate behind it narrowed. ## Verification - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 105 derived families. 101 exit 0. 3 exit 3 (prerequisite not met, NOT MEASURED, left to CI): `check:skill-examples`, `check:dual-build-cjs-loads`, `check:i18n`. 1 not run: `check:type-check-debt`, because the verify lock was held by another run for more than 60 minutes. `--ran` reconciliation agrees. - `--tier`: no path-derived mandate. The same verdict as merged #33646 and #33769. - eslint on the changed `.ts` files: exit 0. `check-nul-bytes`: OK. - `git merge-tree --write-tree` of this head against `origin/main`, #33956, #33268 and branch `claude/area-A2-33828`: clean, no conflicted paths. Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent c8abb82 commit fb79d47

16 files changed

Lines changed: 302 additions & 96 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
'@objectstack/platform-objects': patch
4+
'@objectstack/lint': patch
5+
---
6+
7+
fix(plugin-auth): Set Manager refuses only a person a SCIM directory holds, so an admin can change the manager of someone who signs in through SSO
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
`POST /api/v1/auth/admin/set-user-manager` refused every user whose `sys_user.source` is `idp_provisioned` with `403 PERMISSION_DENIED`, saying a directory owns their manager. ADR-0135 D4 stamps that value on every sign-in through an identity provider by a person with no local password: the platform's own SSO on a hosted environment, and any social or enterprise OIDC provider. Those people have no directory behind them. So after their first sign-in, nobody could change their manager, and approvals routed to the manager could not follow a reorganisation.
13+
14+
The endpoint now refuses only a person a SCIM directory holds: `source` is `idp_provisioned` and a SCIM connection has provisioned or linked them (a `sys_scim_subject` row). The answer is unchanged for them (`403 PERMISSION_DENIED`, `details.reason: 'idp_provisioned'`), and its message says to change the manager in the directory. Everyone else gets the answer a local user gets. The admin user import's `manager_id` column runs the same check, so an SSO-only row's manager link now lands. The self-assignment, cycle, depth and cross-organization refusals are unchanged. Nothing that was accepted before is refused now.
15+
16+
`sys_user`'s **Set Manager** action is now offered to a platform admin on every user row. It used to be hidden on `idp_provisioned` rows. A SCIM-held row is refused by the endpoint, which names the directory.
17+
18+
`os explain approval-approvers-may-resolve-empty` now says the admin operation refuses an identity a SCIM directory holds, and that an identity that only signs in through SSO is set like any other.
19+
20+
The `idp_provisioned` stamp itself (ADR-0135 D4) and the password refusals are unchanged.

‎content/docs/automation/approvals.mdx‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ row's `manager` result: a link it cannot make never fails the user it imported.
100100
The column is also written by a seed, or by any other system-context write, which bypasses the
101101
managed-update whitelist. SCIM provisioning and directory sync can populate it too, but only
102102
through a provisioning path your own deployment supplies: this platform declares the SCIM
103-
`manager` attribute without projecting it onto the column. Where an identity carries
104-
`source: 'idp_provisioned'` the admin operation **refuses**, so that directory stays the one
105-
surface that authors its manager. A user a SCIM connection provisions carries that value from its
106-
creation unless it holds a local password, so for such a user the column is written only by that
107-
deployment-supplied path, and a value the column already holds stays as it is.
103+
`manager` attribute without projecting it onto the column. Where a SCIM directory holds an
104+
identity (it carries `source: 'idp_provisioned'` and the directory has provisioned or linked it)
105+
the admin operation **refuses**, the import's `manager_id` column included, so that directory
106+
stays the one surface that authors its manager; for such a user the column is written only by that
107+
deployment-supplied path, and a value the column already holds stays as it is. A person who only
108+
signs in through SSO also carries `source: 'idp_provisioned'`, but no directory holds them: their
109+
manager is set with **Set Manager** or the import like anyone else's.
108110

109111
Setting the column is still something you have to *do*. Where `manager_id` is unset the rung
110112
expands to nobody, and under the default `onEmptyApprovers: 'admin_rescue'` the request opens on

‎content/docs/capabilities/approvals.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ A specific person · everyone holding a position (e.g. sales managers) · the su
1515
**Routing to the submitter's manager needs each user's manager set.** This style resolves
1616
`sys_user.manager_id`, which is not a profile field: editing the user does not set it. A platform
1717
admin sets it one user at a time from **Setup → Users → ⋯ → Set Manager**, which calls
18-
`POST /api/v1/auth/admin/set-user-manager`. For many users at once, provisioning fills it: the
18+
`POST /api/v1/auth/admin/set-user-manager` — for anyone, people who sign in through SSO included,
19+
except a person a SCIM directory holds, whose manager is changed in that directory. For many users at once, provisioning fills it: the
1920
admin bulk-import endpoint reads a `manager_id` column, and a seed, or a SCIM / directory-sync
2021
path your deployment supplies, can write it too. Until it is set, a manager-only approval step
2122
resolves to nobody and the node's `onEmptyApprovers` policy decides what happens — by default the

‎content/docs/permissions/authentication.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,11 @@ sign-in through any other one leaves the person pending. Their positions, permis
13011301
from the moment they are added, so seed data and approval flows can name them
13021302
before they sign in. Off a managed environment both doors answer `409`.
13031303

1304+
Signing in does not lock the manager: a platform administrator still changes
1305+
it with **Set Manager** (`POST /api/v1/auth/admin/set-user-manager`). That
1306+
endpoint refuses only a person a SCIM directory holds, whose manager is changed
1307+
in the directory.
1308+
13041309
A host can be told about people as they come and go: the `environmentUserHost`
13051310
option of the auth plugin is called after a person is added, and before a
13061311
person is deactivated (`admin/ban-user`) or reactivated (`admin/unban-user`).

‎packages/lint/src/rule-explanations.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,9 +3336,10 @@ const MANAGER_ONLY_ROUTES =
33363336
'write, which bypasses the managed-update whitelist. SCIM provisioning and directory sync can ' +
33373337
'populate it too, but only through a provisioning path your own deployment supplies: this ' +
33383338
'platform declares the SCIM \'manager\' attribute without projecting it onto the column — and ' +
3339-
'where an identity carries source \'idp_provisioned\' the admin operation refuses, the import\'s ' +
3339+
'where a SCIM directory holds an identity the admin operation refuses, the import\'s ' +
33403340
'manager_id column included, leaving that directory the one surface that authors its ' +
3341-
'manager. Or declare onEmptyApprovers: \'fallback\' on the node, with a ' +
3341+
'manager. An identity that only signs in through SSO, with no SCIM directory behind it, is set ' +
3342+
'through the admin operation like any other. Or declare onEmptyApprovers: \'fallback\' on the node, with a ' +
33423343
'fallbackApprovers list: an empty manager rung then opens the request on those people instead ' +
33433344
'of on the organization\'s administrators, which needs no write to the column at all.';
33443345

‎packages/lint/src/validate-approval-approvers.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,18 @@ describe('unset-manager dead-end (#16748)', () => {
375375
// ⛔ And they must not be deleted: a deployment running a real directory
376376
// sync may well populate the column, and the defect was presenting all
377377
// three as equally available, never naming them at all. They now also take
378-
// PRECEDENCE — the endpoint refuses an `idp_provisioned` identity, and so
379-
// does the import's `manager_id` column, which runs the same derivation —
378+
// PRECEDENCE — the endpoint refuses an identity a SCIM directory holds, and
379+
// so does the import's `manager_id` column, which runs the same derivation —
380380
// so the hint must not read as "use the endpoint instead of your directory".
381381
expect(remedy).toContain('SCIM provisioning and directory sync can populate it');
382-
expect(remedy).toContain("source 'idp_provisioned' the admin operation refuses");
382+
expect(remedy).toContain('where a SCIM directory holds an identity the admin operation refuses');
383383
expect(remedy).toContain("the import's manager_id column included");
384+
// ⛔ But only where a directory exists: the `idp_provisioned` mark alone
385+
// also covers a person who only signs in through SSO, whose manager the
386+
// endpoint sets (maintainer ruling record 6895645364). A remedy that sent
387+
// that admin to a directory they do not have cannot be carried out.
388+
expect(remedy).not.toContain("source 'idp_provisioned' the admin operation refuses");
389+
expect(remedy).toContain('only signs in through SSO');
384390
});
385391

386392
it('the one-line `fix:` names the first route and the escape, and never the Console form', () => {

‎packages/lint/src/validate-approval-approvers.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ const STAYS_LOCKED = ', and (lockRecord) the record stays locked';
144144
* It reaches the column under a SYSTEM context — by context, ⛔ not by a
145145
* whitelist entry — which is why the whitelist reading above is unchanged.
146146
* It refuses self-assignment, a link that closes a cycle, a chain past its
147-
* depth cap, a manager provably outside the user's organizations, and any
148-
* identity whose `sys_user.source` is `idp_provisioned`.
147+
* depth cap, a manager provably outside the user's organizations, and an
148+
* identity a SCIM directory holds (`sys_user.source` `idp_provisioned` AND
149+
* a `sys_scim_subject` row). An `idp_provisioned` identity with no SCIM
150+
* subject — a person who only signs in through SSO — is set like any other
151+
* (maintainer ruling record 6895645364).
149152
* - Seed, or any other system-context write — AVAILABLE HERE, unchanged.
150153
* Both write guards gate on `isUserContextWrite`, spelled identically in
151154
* each: `Boolean(userId) && isSystem !== true` (plugin-security
@@ -179,7 +182,7 @@ const STAYS_LOCKED = ', and (lockRecord) the record stays locked';
179182
* one may well populate the column through it — but named as something the
180183
* operator's own provisioning supplies, ⛔ never as something this repo gives
181184
* them. They also now have PRECEDENCE over the endpoint rather than merely
182-
* sitting beside it: on an `idp_provisioned` identity the endpoint refuses, so
185+
* sitting beside it: on an identity a SCIM directory holds the endpoint refuses, so
183186
* the directory is the one authoring surface for those rows.
184187
*
185188
* ⛔ WHAT DID NOT CHANGE — and why this rule is not deleted. The dead end the

‎packages/platform-objects/src/identity/sys-user-set-manager-action.test.ts‎

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@
1515
* managed-update whitelist is `{name, image, locale}`, so a picker that
1616
* PATCHed `/api/v1/data/sys_user/:id` would be refused by the identity
1717
* write guard — correctly — and would read as a Console bug.
18-
* 2. **The `visible` predicate carries the directory-sync term and NOT the
19-
* self-service ownership term.** The three self-service identity actions
20-
* on this object spell `record.source != "idp_provisioned"` as one half of
21-
* `record.id == ctx.user.id && …`. Copying that predicate whole — the
22-
* natural thing to do, and what a reader of the card would do — would hide
23-
* an ADMIN action on someone else's row from every admin. The failure is
24-
* silent and fail-closed (#8990): the button simply is not offered.
18+
* 2. **The `visible` predicate reads NO record column — neither the
19+
* self-service ownership term nor the `source` term.** The three
20+
* self-service identity actions on this object spell
21+
* `record.source != "idp_provisioned"` beside `record.id == ctx.user.id`.
22+
* Copying either half — the natural thing to do — hides an ADMIN action
23+
* from rows the endpoint accepts: the ownership half from every admin,
24+
* the `source` half from every person who only signs in through SSO
25+
* (ADR-0135 D4 stamps them `idp_provisioned` with no directory behind
26+
* them; maintainer ruling record 6895645364, option A, has the endpoint
27+
* refuse only an identity a SCIM directory holds). The failure is silent
28+
* and fail-closed (#8990): the button simply is not offered.
2529
* 3. **No second copy of the server's refusals.** Self-assignment, cycle,
26-
* depth, cross-organization and directory-owned identity are all enforced
30+
* depth, cross-organization and SCIM-held identity are all enforced
2731
* at the write, in one derivation (`applyUserManagerLink`), which the bulk
2832
* importer already routes onto rather than re-deriving. A client-side
2933
* duplicate is the drift, not the safety net — so this file pins that the
30-
* declaration reads exactly one record column and declares no predicate
31-
* for any of the other four refusals.
34+
* declaration reads no record column and declares no predicate for any
35+
* of the five refusals.
3236
*
3337
* The sweep in `action-predicate-sparse-face.test.ts` already covers this
3438
* action's predicate for the sparse-face guard; that is deliberately not
@@ -130,14 +134,17 @@ describe('#19249 — sys_user.set_user_manager posts the admin endpoint', () =>
130134
it('⛔ declares no second copy of the server-side refusals', () => {
131135
// Every refusal is enforced at the write and surfaces from there. What
132136
// would go wrong quietly is a client-side re-derivation drifting from the
133-
// endpoint's; so the predicate is pinned to the ONE column it reads, and
134-
// the declaration to having no other gate at all.
137+
// endpoint's; so the predicate is pinned to reading no record column at
138+
// all, and the declaration to having no other gate.
135139
const visible = sourceOf(ACTION.visible);
136140
expect(visible).toBeDefined();
141+
// Positive control: the standing term really is there, so the empty column
142+
// set below is a reading of the predicate, not of an absent one.
143+
expect(visible).toContain('current_user.isPlatformAdmin == true');
137144
const columns = new Set(
138145
[...visible!.matchAll(/record\.([a-z_][a-z0-9_]*)/gi)].map((m) => m[1]),
139146
);
140-
expect([...columns]).toEqual(['source']);
147+
expect([...columns]).toEqual([]);
141148
expect(ACTION.disabled).toBeUndefined();
142149
// The manager chain, the organization screen and the self-assignment check
143150
// are the endpoint's; none of them is expressible — or declared — here.
@@ -148,15 +155,22 @@ describe('#19249 — sys_user.set_user_manager posts the admin endpoint', () =>
148155
});
149156
});
150157

151-
describe('#19249 — the visible predicate: directory-sync term, NOT the self-service one', () => {
158+
describe('the visible predicate: offered on every row, the SCIM-held refusal is the server\'s', () => {
152159
const visible = (): string => {
153160
const source = sourceOf(ACTION.visible);
154161
if (!source) throw new Error('set_user_manager has no CEL source');
155162
return source;
156163
};
157164

158-
it('is hidden for a directory-owned identity (the server answers 403 idp_provisioned)', () => {
159-
expect(evaluate(visible(), { source: 'idp_provisioned' })).toBe(false);
165+
it('⭐ is OFFERED on an idp_provisioned row — an SSO-only person\'s manager is set here', () => {
166+
// The endpoint answers 200 for this row unless a SCIM directory holds it,
167+
// and no column on the row says which; hiding the button here hid it from
168+
// every person who ever signed in through SSO.
169+
expect(evaluate(visible(), { id: 'someone_else', source: 'idp_provisioned' })).toBe(true);
170+
});
171+
172+
it('is OFFERED on the sparse face too (no source column projected)', () => {
173+
expect(evaluate(visible(), { id: 'someone_else' })).toBe(true);
160174
});
161175

162176
it('⭐ is OFFERED to an admin on someone else\'s env-native row', () => {
@@ -165,13 +179,22 @@ describe('#19249 — the visible predicate: directory-sync term, NOT the self-se
165179
expect(evaluate(visible(), { id: 'someone_else', source: 'env_native' })).toBe(true);
166180
});
167181

168-
it('carries the same directory-sync term the self-service actions spell', () => {
169-
// Byte-identical term, so the two never drift into two spellings of one
170-
// rule — while the ownership half they also carry stays out (asserted
171-
// above by the offered-to-an-admin verdict).
172-
expect(visible()).toContain('record.source != "idp_provisioned"');
182+
it('⛔ does NOT carry the self-service actions\' source term', () => {
183+
// Positive control: the term is still spelled on the self-service side
184+
// (password and identity edits stay hidden for a managed identity, ADR-0135
185+
// D4), so its absence here is a reading, not a rename.
173186
const selfService = actionsOf().find((a) => a.name === 'change_my_password');
174187
expect(sourceOf(selfService?.visible)).toContain('record.source != "idp_provisioned"');
188+
expect(visible()).not.toContain('record.source');
189+
});
190+
191+
it('is still hidden from a caller without platform-admin standing', () => {
192+
const member = { id: 'm_1', isPlatformAdmin: false, positions: [] as string[] };
193+
const r = celEngine.evaluate(
194+
{ dialect: 'cel', source: visible() },
195+
{ record: { id: 'someone_else', source: 'idp_provisioned' }, extra: { current_user: member, user: member, ctx: { user: member }, os: { user: member }, features: {} } },
196+
);
197+
expect(r.ok && r.value).toBe(false);
175198
});
176199

177200
it('⛔ is NOT gated on features.admin, and that is deliberate', () => {

‎packages/platform-objects/src/identity/sys-user.object.ts‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -685,23 +685,22 @@ export const SysUser = ObjectSchema.create({
685685
recordIdParam: 'userId',
686686
successMessage: 'Manager updated',
687687
refreshAfter: true,
688-
// Hidden for a directory-managed identity, whose manager the IdP owns:
689-
// the endpoint's refusal 5 answers 403 / `idp_provisioned`, so the
690-
// button would be an affordance the server side refuses by design.
691-
// This carries the SAME `record.source` term the three self-service
692-
// identity actions below carry — and only that term: this is an admin
693-
// action on someone else's row, so their `record.id == ctx.user.id`
694-
// half is deliberately NOT copied (it would hide the button from every
695-
// admin). `has()` per operand for the sparse action face (#8990) — the
696-
// rationale is on the self-service block below.
688+
// Offered on every row, `idp_provisioned` ones included, and the
689+
// endpoint refuses the one case it must. Its refusal 5 answers 403 /
690+
// `idp_provisioned` only for an identity a SCIM directory HOLDS (a
691+
// `sys_scim_subject` row, maintainer ruling record 6895645364, option
692+
// A); a person who only signs in through SSO carries the same `source`
693+
// with no directory behind them, and their manager is set here. No
694+
// column on this row says "held by SCIM", so ⛔ a `record.source` term
695+
// would hide the button from every SSO-only person — the defect this
696+
// predicate used to carry — and a SCIM-held row is answered by the
697+
// server's refusal, which names the directory to go to.
697698
//
698-
// ANDed ahead of it, the platform-admin standing the door's gate judges
699-
// (ADR-0068 D4, the admin block header above): without it the button
700-
// was offered to every caller who could open a user row, and the door
701-
// refused each one 403 `PERMISSION_DENIED`. One flat conjunction, the
702-
// principal term first, the way the self-service predicates below lead
703-
// with theirs.
704-
visible: 'current_user.isPlatformAdmin == true && has(record.source) && record.source != "idp_provisioned"',
699+
// The platform-admin standing the door's gate judges (ADR-0068 D4, the
700+
// admin block header above): without it the button was offered to every
701+
// caller who could open a user row, and the door refused each one 403
702+
// `PERMISSION_DENIED`.
703+
visible: 'current_user.isPlatformAdmin == true',
705704
// The action collects a param, so its explanatory line rides
706705
// `description` and ⛔ never `confirmText` — pairing the two shows two
707706
// dialogs for one decision (#7278/#7309).

‎packages/platform-objects/src/platform-objects.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ describe('feature-gate lowering matrix (#2874)', () => {
772772
// The rest of the platform-admin family. Three carry no feature gate, so
773773
// the authored predicate is served as written — no lowering — and is
774774
// pinned here anyway, beside add_member, so every member has its row.
775-
['SysUser', SysUser, 'set_user_manager', `${STANDING} && has(record.source) && record.source != "idp_provisioned"`],
775+
['SysUser', SysUser, 'set_user_manager', STANDING],
776776
['SysSsoProvider', SysSsoProvider, 'register_sso_provider', STANDING],
777777
['SysSsoProvider', SysSsoProvider, 'register_saml_provider', STANDING],
778778
['SysSsoProvider', SysSsoProvider, 'request_domain_verification', STANDING],

0 commit comments

Comments
 (0)