Repository navigation
Commit 2b11a71
feat(platform-objects): add and remove an IdP group mapping from Setup (objectstack-ai#32235)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB9FtKWefJAsfBknskRbuBTi)_
Part of objectstack-ai#32185 (item 2: the IdP group-mapping form in Setup)
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 改了什么:Setup → IdP Group Mappings 不再只读。`sys_idp_group_mapping` 声明了三个
`type: 'api'` 动作:列表工具栏的 **Map SSO Group** / **Map SCIM Group**(POST
`set-group-mapping`),每行的 **Delete Mapping**(POST
`delete-group-mapping`,`recordIdParam: mappingId` + 确认文案)。只对平台管理员显示,并声明
`manage_platform_settings` 门。plugin-auth 的 set 门在封闭键集里额外放行
`organizationId` 一个键(不读取它)。
- 为什么改:以前只能靠运维脚本直接 POST 这两个门来建、删映射;objectstack-ai#32185 第 2 项要求在 Setup 里有表单。
- 风险与回滚:动作门本来就给 `/api/v1/auth/` 目标盖上 `organizationId`,封闭键集会拒掉它,所以
plugin-auth 改了一行(单独提交 55b5920);映射仍落在源(SCIM 连接 / SSO
提供方)所在的组织,盖章值从不被读取,其它未知键照旧 400 `unknown_field`。数据 API 仍是
`['list']`,`lock: 'full'` 不变。回滚即还原本 PR。
-
先看:`packages/platform-objects/src/identity/sys-idp-group-mapping.object.ts`
的 `actions`
块,`packages/plugins/plugin-auth/src/idp-group-mapping-admin.ts:100` 和
`:335`。
- 两分钟验证:`pnpm --filter @objectstack/platform-objects exec vitest run
src/identity/sys-idp-group-mapping-actions.test.ts`(11 例通过),`pnpm
--filter @objectstack/plugin-auth exec vitest run
src/scim-group-projection.test.ts -t "organizationId stamp"`(2 例通过)。
- 需要你做的:无,席位落地。objectstack-ai#32186 已落地,本分支已合并 main(无冲突),用生成器重新生成翻译,无差异。
## Why the plugin-auth file rides here
The order assumed the door needed no change. Measured: every `type:
'api'` action aimed at an `/api/v1/auth/` path is posted with the
caller's active organization stamped into the body as `organizationId`,
on the server's action door
(`packages/runtime/src/action-execution.ts:1604`) and on the console's
direct path
(`ui/packages/app-shell/src/hooks/useConsoleActionRuntime.tsx:559`).
`set-group-mapping` closes its body key set, so before this change every
declared Map action was refused `400 VALIDATION_FAILED`
(`organizationId: unknown_field`) for any admin with an active
organization. The seat ruled the door admits exactly that key and reads
nothing from it; the change is its own commit (55b5920) with its own
pins.
## What changes
- **`sys_idp_group_mapping`** (`@objectstack/platform-objects`):
- `map_sso_group`: params `providerId` (required), `groupExternalId`,
`groupDisplayName`, `permissionSet` (required, `widget:
'permission-ref'`, the security-catalog picker). The door judges
"exactly one of the two group keys" and answers with its own sentence.
- `map_scim_group`: the same with `connectionId`. One action per source
kind, so each sends exactly one of `connectionId` / `providerId`.
- `delete_group_mapping`: `list_item` + `record_header`, `recordIdParam:
'mappingId'`, no params, a `confirmText` that says what the delete
removes.
- All three: `requiredPermissions: ['manage_platform_settings']`
(PLATFORM_ADMIN_SETTINGS_GATE), `visible: current_user.isPlatformAdmin
== true`, `refreshAfter`, no `ai` block (they postdate the ADR-0011
identity-actions assessment).
- `listViews.all.emptyState`: the engine-owned bucket's fallback says
rows "appear automatically", which stopped being true; the view now says
how to add one.
- `managedBy: 'engine-owned'` (the "System-managed" header badge) is
unchanged: it also enrols the object in plugin-security's engine-owned
write guard, so changing it is not safe here.
- **`@objectstack/plugin-auth`**: `set-group-mapping` admits
`organizationId` (`ACTION_DOOR_STAMP_KEY`) and ignores it; route-ledger
notes name the three actions.
- **Translations**: regenerated with `node
scripts/check-i18n-bundles.mjs --write`; the new leaves translated in
all ten non-English locales, then regenerated again so the source-hash
companions settle. No generated structure edited by hand.
- **Docs**: `content/docs/permissions/sso.mdx` "Saving a mapping" names
Setup → IdP Group Mappings and its three actions; the curl path stays as
the operator route.
- **Changeset**: `.changeset/32185-idp-group-mapping-setup-actions.md`
(both packages, patch).
## Tests
- `sys-idp-group-mapping-actions.test.ts` (new, 11): route, method,
locations, param names and required set; every param is a key the save
admits and each Map action names exactly one source; the picker widget;
delete's `recordIdParam` + confirm; a live-instrument control; the
declared gate; CEL visibility for a platform admin (true), an org admin
and a member (false); no `ai.exposed`; lock / list-only API /
engine-owned unchanged; the list's own empty state.
- `platform-admin-affordance-standing.test.ts`: the family floor names
the three actions.
- `scim-group-projection.test.ts` (2 new): a body carrying
`organizationId` naming another org lands in the source's organization;
`organizationId` + `tenantId` is refused with only `tenantId:
unknown_field` and nothing stored. (Inserted before the agent-ceiling
block, not at the end, to stay clear of objectstack-ai#32186's append.)
- `useConsoleActionRuntime.createUserRequiredField-28289.test.tsx` (5
new, console against a stub door): Map SSO Group posts to
`/api/v1/actions/sys_idp_group_mapping/map_sso_group` and refreshes; a
boundary `400` shows the door's sentence in the dialog, keeps the
values, no refresh; a `409` conflict shows its first sentence and the
"More" disclosure reveals the delete-first instruction; Delete asks the
confirm sentence once and posts `mappingId`; a `404` delete surfaces the
door's sentence.
### Ablations (`scripts/ablation-replace.mjs`, restored, `git diff HEAD`
empty after each)
| # | mutation | result |
|---|---|---|
| A1 | `delete_group_mapping`'s `requiredPermissions` → `[]` | red: 2 of
16 (`each declares the door's platform-settings gate…` here, and the
affordance-standing floor's `each member declares its gate…`) |
| A2 | drop `&& key !== ACTION_DOOR_STAMP_KEY` in the door | red: both
stamp cases (`organizationId is not a field of a group mapping…`,
`expected 400 to be 200`) |
A1's first attempt was refused by the tool (replacement count 1→1, the
replacement contained its anchor) and re-run with a marker replacement.
## Acceptance notes
- Browser, showcase dev boot, platform admin, SSO on (a SAML provider
registered): add a mapping and see the row; pick `admin_full_access` and
see the door's refusal sentence in the dialog; delete the mapping from
the row menu with the confirm sentence and see the empty state.
Screenshots in the os-dev report.
- The permission-set picker lists the whole catalog, administrator sets
included; the door refuses those with its boundary sentence. Narrowing
the picker would need a filtered data source the widget does not take
today.
- A refusal shows twice in the dialog (the runner's toast and the
dialog's refusal box); that is the shared action runtime, unchanged
here.
- Serial with objectstack-ai#32186, which landed first (9052363). This branch merged
`origin/main` at `e40f2df299` with no conflict; `node
scripts/check-i18n-bundles.mjs --write` on the merged tree changed
nothing. objectstack-ai#32186's `match_status` fields and my actions sit side by side
in the object file, and its cases and mine in
`scim-group-projection.test.ts`.
## Verification
Head `141ac9be38` (merge of `origin/main` at `e40f2df299`, which
includes objectstack-ai#32186). Every run below on that tree under
`scripts/pm/os-verify-lock.sh`, `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/platform-objects exec vitest run`: 121
files, 1945 tests passed.
- `pnpm --filter @objectstack/plugin-auth exec vitest run`: 257 files,
4627 passed, 10 skipped.
- `cd ui && pnpm exec vitest run
packages/app-shell/src/hooks/__tests__/useConsoleActionRuntime.createUserRequiredField-28289.test.tsx`:
11 passed.
- Type-check: `@objectstack/plugin-auth` `typecheck` and
`@objectstack/platform-objects` `typecheck` exit 0 on the merged tree;
`@object-ui/app-shell` `type-check` exit 0 at `52a8d5b8` (the merge
touched nothing under `ui/packages/app-shell`).
- `node scripts/check-sdui-manifest.mjs` exit 0; `pnpm --dir ui run
check:spec-symbols` exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands`: 104 families (the
docs page widened the set from 74), every one run, every one exit 0,
including `check:i18n`, `check:i18n-stale-fill`, `check-affected-docs`,
`check:doc-authoring`, `check:doc-anchors` and
`check:doc-security-posture`. `--ran`: 104 derived, 104 run, 0
NOT-MEASURED, 0 UNRUN.
- Artifact-roster families whose roster sits under a directory this
change touches, run as well: `check:authz-resolver`,
`check:changeset-fixed`, `check:error-code-casing`,
`check:filter-alias-parity`, `check:route-ledger-census`: all exit 0.
- Not run locally: CI's Test Core shards, dogfood jobs and workspace
type-check lanes (outside the derived set). No dogfood battery: the
title has no `!` and the Clause-② line carries the `(widening)` arm.
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzhYZn6qndaRrxvWoBV
<!-- signed: domain:ui#2 · os-support-ai ·
session_01WGufzhYZn6qndaRrxvWoBV -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent c147fc2 commit 2b11a71
20 files changed
Lines changed: 1227 additions & 20 deletions
File tree
- .changeset
- content/docs/permissions
- packages
- platform-objects/src
- apps/translations
- identity
- plugins/plugin-auth/src
- ui/packages/app-shell/src/hooks/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
515 | | - | |
516 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
517 | 533 | | |
518 | 534 | | |
519 | 535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2871 | 2871 | | |
2872 | 2872 | | |
2873 | 2873 | | |
2874 | | - | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2875 | 2932 | | |
2876 | 2933 | | |
2877 | 2934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2871 | 2871 | | |
2872 | 2872 | | |
2873 | 2873 | | |
2874 | | - | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2875 | 2932 | | |
2876 | 2933 | | |
2877 | 2934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2871 | 2871 | | |
2872 | 2872 | | |
2873 | 2873 | | |
2874 | | - | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2875 | 2932 | | |
2876 | 2933 | | |
2877 | 2934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2871 | 2871 | | |
2872 | 2872 | | |
2873 | 2873 | | |
2874 | | - | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2875 | 2932 | | |
2876 | 2933 | | |
2877 | 2934 | | |
| |||
0 commit comments