Repository navigation
Commit 7788eed
fix(app-shell): a member refused the Setup app gets the access-denied screen on the Setup create form too (#29237)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbLD68mjjNpw7dAnZ7BBKoKi)_
Fixes #29102
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:没有 Setup 应用权限的普通成员打开 Setup 下的新建表单(`/apps/setup/sys_user/new`
这类别名地址)时,现在看到与同一对象列表页相同的「无权访问此应用」页面;规范地址
`/apps/com.objectstack.setup/OBJECT/new` 也是同一页面。
- 为什么改:上一张卡只拦了列表路由,新建表单仍会套着默认应用的顶栏和侧栏显示,地址栏写着 setup,像进了管理后台。
- 风险与回滚:只改界面判定,服务端对每次写入的权限判定不变;管理员不受影响(不发起探测)。审批收件箱链接到的记录页
`/apps/setup/OBJECT/record/ID` 按 objectui#12706 的未决决定保持原样。回滚即还原本 PR。
-
先看:`ui/packages/app-shell/src/console/AppContent.tsx`(`OBJECT_COLLECTION_ROUTE_PATHS`
新增的 `:objectName/new` 一行)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/console/__tests__/AppContent.setupObjectListVerdict-28988.test.tsx`,预期
16 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
- The route set that waits on the Setup app's access verdict under the
`setup` alias now includes the create form, `:objectName/new`, beside
the list routes #28988 added (`:objectName`, `:objectName/view/:viewId`,
`:objectName/data`). A `denied` verdict draws `app-access-denied` and
the form never mounts.
- The set and its matcher are renamed for what they now hold, the object
routes that name no record: `OBJECT_LIST_ROUTE_PATHS` becomes
`OBJECT_COLLECTION_ROUTE_PATHS`, `isObjectListAppRoute` becomes
`isObjectCollectionAppRoute`, and `isSetupObjectListRoute` becomes
`isSetupObjectCollectionRoute`. Matching is unchanged: by route rank
against `APP_ROUTE_METADATA_READS` plus the host's routes, so a static
or host route under the Setup segment is never read as one.
- Record routes (`OBJECT/record/ID`, its `/edit` and `/page/NAME`, and
the `OBJECT/ID` shorthand) stay outside the gate, as objectui#12706
leaves them. No metadata key or option is added.
## Why
`/apps/setup` is a pseudo-route, so an unmatched `setup` segment falls
back to the launcher's default app unless `appSurfaceAwaitsVerdict`
names the sub-route. After #28988 it named the list routes only, so a
refused member on `/apps/setup/OBJECT/new` got the create form inside
the default app's chrome. The create form names no record, so no
approvals-inbox link lands on it. The canonical
`/apps/com.objectstack.setup/OBJECT/new` is an ordinary unmatched app
and already drew the refusal; it is pinned here so both spellings stay
the same.
## Tests
- `AppContent.setupObjectListVerdict-28988.test.tsx` gains a stubbed
`RecordFormPage` (counted like the other page stubs) and four cases:
- A refused caller gets `app-access-denied`, no `ConsoleLayout` and no
page mounted, on `/apps/setup/sys_user/new`,
`/apps/setup/showcase_task/new` and
`/apps/com.objectstack.setup/sys_user/new`. The one by-name probe is the
app the URL names, and the URL is left as typed.
- Control: an admitted caller gets the create form (`mode="create"`)
under Setup, unprobed.
- The existing control that a refused caller still opens the record page
the approvals inbox links to (`/apps/setup/sys_user/record/usr_000001`)
passes unchanged, as do the objectui#12706 file's inbox controls.
- Red on `main`: with `AppContent.tsx` at `c44c8ac4` and the new tests
unchanged, the two alias cases fail (Tests 2 failed, 14 passed). The
package-id case and the controls pass there.
## Acceptance notes
- The canonical spelling needed no code change; the test pins it so the
two spellings cannot drift apart again.
- Record routes under the Setup segment are untouched, per the claim and
objectui#12706.
## Verification
<details><summary>Local runs</summary>
Head `83289601` (fix `ead56761` plus a merge of `main` at `49aba82b`;
base `c44c8ac4`). The suites below marked "merged head" ran on
`83289601`; the rest ran on `ead56761`, and the merge brought nothing
into `ui/packages/app-shell/src/console/AppContent.tsx` or its tests.
- Prerequisite build under the verify lock: `turbo run build
--filter='@object-ui/app-shell^...'` plus formula, sdui-parser, lint and
client, 64 of 64 tasks.
- The edited file with the #27507, objectui#12706 and #28578 Setup
verdict files: Test Files 4 passed, Tests 119 passed.
- Red on `main` (`AppContent.tsx` at `c44c8ac4`, restored to the HEAD
blob afterwards, `git diff HEAD` empty): Tests 2 failed, 14 passed.
- Every `packages/app-shell` test file that names `AppContent` (`git
grep -l`, 93 files), on `ead56761` and again on the merged head after
rebuilding the closure: Test Files 93 passed, Tests 777 passed, both
times. A narrowing of app-shell's suite; CI's Test UI shards run the
rest.
- `turbo run type-check --filter=@object-ui/app-shell` (its script also
runs `tsc -p tsconfig.test.json`, so the test is compiled): 65 of 65
tasks.
- `node scripts/pm/dispatch-gates.mjs --commands`: 34 derived commands,
each exit 0, among them `check-sdui-manifest.mjs`,
`check-changeset-no-major.mjs --base origin/main`,
`check:type-check-debt`, `check:published-files`, `check:nul-bytes` and
`pnpm --dir ui exec vitest run scripts/` (Test Files 169 passed, 2
skipped; Tests 4900 passed, 2 skipped). `--ran` reconciliation: 34
derived, 34 run, 0 NOT-MEASURED. The derivation on the merged head is
identical, and the PR-body and changeset gates were run again there
against this body. `pnpm check:new-line-citations`: 0 new citations.
- Not measured: a browser run of the built Console as a real member. The
test drives the real adapter's probe over the server's 403 envelope.
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` not touched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` is CI's run.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not applicable.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 section is
the Chinese summary the repo asks for).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jU9jKHFCJuQuuKRtpX
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jU9jKHFCJuQuuKRtpX)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 39951d2 commit 7788eed
3 files changed
Lines changed: 73 additions & 17 deletions
File tree
- .changeset
- ui/packages/app-shell/src/console
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
209 | 210 | | |
210 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
211 | 217 | | |
212 | 218 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
217 | 224 | | |
218 | | - | |
| 225 | + | |
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
222 | | - | |
| 229 | + | |
223 | 230 | | |
224 | 231 | | |
225 | 232 | | |
| |||
579 | 586 | | |
580 | 587 | | |
581 | 588 | | |
582 | | - | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
583 | 595 | | |
584 | 596 | | |
585 | 597 | | |
586 | 598 | | |
587 | | - | |
| 599 | + | |
588 | 600 | | |
589 | 601 | | |
590 | 602 | | |
591 | | - | |
| 603 | + | |
592 | 604 | | |
593 | 605 | | |
594 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | | - | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
246 | 254 | | |
247 | 255 | | |
248 | 256 | | |
249 | | - | |
| 257 | + | |
250 | 258 | | |
251 | 259 | | |
252 | 260 | | |
| |||
298 | 306 | | |
299 | 307 | | |
300 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
301 | 337 | | |
302 | 338 | | |
303 | 339 | | |
| |||
0 commit comments