Skip to content

Commit 68aa1be

Browse files
feat(setup): the environment directory moves from Studio to Setup's access group (#37602)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgU5DKF7KXCzL3BS7FYTB4qi)_ Fixes #37565 Clause-②: no Metadata-protocol: none ## 维护者速读 - 岗位、能力、权限集、共享规则的全环境目录,从 Studio 菜单搬到 Setup 的“访问控制”分组,名为“岗位与权限”。 - Studio 菜单不再有这一项;对能进 Setup 的用户,旧的书签和链接只跳转一次,直接落到 Setup 的新页面;不能进 Setup 的 Studio 用户仍在 Studio 里看这些列表。 - 进入门槛没有放宽:新入口和新页面都要求进入 Studio 所需的同一项权限,外加 Setup 本身的权限。 - 在目录里点开某一条,仍在 Studio 的编辑器中打开;Studio 找不到包时的默认落点暂时改为“无包”范围,等“移入包”功能上线后一并撤掉。 ## What changes - **New Setup entry**: `nav_access_directory` ("Positions and Permissions", icon `key-round`) in Setup's `group_access_control`, contributed by `packages/platform-objects/src/apps/setup-nav.contributions.ts`, with `requiredPermissions: ['studio.access']`. Labels in all 11 locale packs, source hashes updated. - **New Setup page** `security:access-directory` (`/apps/setup/component/security/access-directory`), registered in `builtinComponents.tsx`. It serves the directory and each environment type's list (`permission`, `position`, `capability`, `sharing_rule`, `?scope=environment`) by mounting the existing metadata-admin directory and list pages under the cross-package leg's host shape (no package, writable), rooted at the page. Without `studio.access` it renders an alert naming the capability and reads nothing. - **Rows open the item editor in Studio**: an item, a create and a history under the Setup page go to `/studio/~all/metadata/<type>/<name>?scope=environment`, the editor the environment scope uses today, because an environment item is edited by name and may belong to no package. - **Studio's `~all` menu entry is retired** (`studioMenuModel.ts`, its label key and icon). The package-less menu's access rows point at the Setup page's type lists for a user holding `setup.access`; without it they keep the Studio environment-scope lists (`/studio/~all/metadata/<type>?scope=environment`). - **Old addresses redirect once**: `/studio/~all`, `/studio/~all/metadata` and a list of one of the four types in the environment scope, including Setup's old `/apps/setup/metadata/...` catalog addresses, land on the Setup page in one hop for a user holding `setup.access` (inside Studio read from the set Studio's entry gate hands its pages; on Setup's old aliases from the session's capability answer, read fail-closed). Without it, the leg keeps them and a bare `/studio/~all/…` lands on `/studio/~all/metadata`. The cross-package list of any other type, and item pages, stay in Studio. - **Studio's no-package fallback** (`studioEntryFallbackPath`, `newPackageDoorPath`) now lands on `/studio/~org/metadata/flow?source=runtime` instead of the retired directory. ⚠️ This is temporary: `~org` retires with the Phase 4 "move into package" door (Q3 ruling 7184753035), and the fallback moves with it. - The Studio package-not-found button's label (`engine.studio.notFound.allMetadata`, key unchanged) now names where it goes: "Open organization flows" / 打开「组织流程」. - Surface added with the area's approval (claim amendments on #37565; the third adds the `setupMetadataStudioPath` call sites in `ui/packages/app-shell/src/console/AppContent.tsx` and `ui/apps/console/src/AppContent.tsx`): a one-line re-export of `ACCESS_DIRECTORY_PATH` (and, in the rework, `holdsSetupAccess`) from `ui/packages/app-shell/src/index.ts`; a doc-comment-only edit in `StudioEntryRedirect.tsx`; one sentence each in `content/docs/permissions/authorization.mdx` and `content/docs/permissions/permission-sets.mdx`, and two lines of `content/docs/permissions/administrator-guide.mdx` (the matrix editor's path and the where-to-find table row), re-pointed at Setup → Access Control (second claim amendment); and `StudioPaletteGroups.tsx` drops the retired kind's icon key and its import, which the full build refused to compile. ### Answer to #37424 comment 7188504633 (a) The package's 全部类型 directory still lists `datasource` where the package holds one, and that tile still opens Setup → Datasources (the directory's href override). This PR does not change that; removing the menu row is #37564's job. The new Setup access directory lists only the four environment types and never `datasource`. ## Tests - New: `views/setup/accessDirectory.test.ts` (address model: what lands on Setup, what stays in Studio, one hop both ways) and `views/setup/AccessDirectoryPage.test.tsx` (gate refusal with control, the host shape, the four lists, scope added, items/create/history open in Studio). - Re-pointed, not weakened: every test that pinned `~all` now pins the Setup page or the Studio item editor, and the retired entry is pinned absent (`studioMenuModel`, `StudioMenu`, `StudioPaletteGroups.surfaceScope-36900`, `setupMetadataRedirect`, `AppContent.setupMetadataStudio-28578`, console `AppContent.legacyRedirects`, `AppContent.systemHubRoutes`, `StudioRoute.metadataArea-28561`, `StudioEntryRedirect`, `HomePage.noAgentsBuildChip-26614`, `StudioDesignSurface.metadataArea-28561`, `StudioMetadataArea.routes-28561`, `StudioPackageMenu-37139` (its `~all/overview` case now lands on Setup, plus an item page the leg still draws), `StudioDesignSurface.notFound-26708`, `SidebarAppMenu-36112`, `AppContent.emptyNavigationLanding-12079`, `AppContent.noAppComponentRoutes` (the zero-app legacy directory alias: one hop to Setup, then the no-apps empty state that branch renders for every Setup page; ablated: identity `studioAddressAfterSetupMove` turns it red), `AppContent.pseudoRouteSegments`), and the live e2e `declared-sharing-rules-reach-13091` lists from the Setup page. ## Acceptance notes - The access rule does not widen: the Setup entry and the page both require `studio.access` on top of Setup's own access, with parity with the Studio gate pinned by test. - Sequencing: `studioMenuModel.ts` and `StudioMenu.tsx` are also edited by #37454 (PR #37546); main is merged once after it lands. Whichever of this PR and #37564 lands second merges main. ## Verification Rework round (seat L1 at `4320d105`), pushed on the same branch, no rebase. Head `0471b08e`; CI result is reported on the PR once green. - M1: parity with the Studio gate, pinned on each of that gate's own policy cases (holder, operator, tenant owner, reported empty set, no reported set), with an ablation that turns the parity tests red. - S1: full-chain `toEqual([from, to])` restored in both `AppContent.systemHubRoutes` tables and the `TO_SETUP_DIRECTORY` block of `AppContent.setupMetadataStudio-28578`. - S2: both branches tested in `studioMenuModel`, `StudioMenu`, `StudioMetadataArea.routes-28561` and console `StudioRoute.metadataArea-28561`; ablating the four `setup.access` reads turns 12 cases red. - S3 (delta review): Setup's old catalog aliases (`/apps/*/metadata…`, `component/metadata/directory`, `system/{positions,roles,permissions}`) take the same `setup.access` branch, a set never reported counting as none. Both branches and the no-answer case are pinned in `setupMetadataRedirect`, `AppContent.setupMetadataStudio-28578`, console `AppContent.systemHubRoutes` and `AppContent.legacyRedirects`; ablating the branch (42 cases) or reading it fail-open turns them red. - N1/N2: the i18n comment and the two doc sentences corrected (only the `?scope=environment` lists redirect, and only for a user who can open Setup). - Unit: all 20 test files this branch touches green. Type-check: `@object-ui/app-shell`, `@object-ui/console` green. Gates: `check:test-source-alias`, `check:i18n`, `check:nul-bytes`, `check:doc-authoring`, `check-affected-docs` green. Earlier round, at `4320d105`: CI 61 success, 0 failed; derived gates (67 commands) green, full `pnpm build` and `pnpm console:build` green. - Browser, showcase app booted locally, signed in as the seeded admin, light and dark (8 screenshots): - `/apps/setup/component/security/access-directory` shows the directory of the four types, with **Access Control → Positions and Permissions** selected in Setup's sidebar. - `/studio/com.example.showcase/metadata`: the Studio menu's Access group no longer carries the cross-package entry. - An old link, `/studio/~all/metadata/position?scope=environment`, lands on `/apps/com.objectstack.setup/component/security/access-directory/position?scope=environment` and lists the 17 positions. - Follow-up noted, not in this card: the Setup page reuses the directory's own heading ("All Metadata Types"); a page-specific heading would read better. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CZhAqkgRyMYuZeZt9S --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6679160 commit 68aa1be

65 files changed

Lines changed: 1318 additions & 206 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/platform-objects': patch
3+
'@object-ui/app-shell': patch
4+
'@object-ui/i18n': patch
5+
'@object-ui/console': patch
6+
---
7+
8+
feat(setup): the environment directory (positions, capabilities, permission sets, sharing rules) moves from Studio's menu to Setup → Access control
9+
10+
Clause-②: no
11+
Metadata-protocol: none
12+
13+
Studio develops one package, and Setup holds what is global (ADR-0084, amended 2026-11-26). The cross-package directory of the environment's access metadata (positions, capabilities, permission sets and sharing rules) is now a Setup page: **Setup → Access control → Positions and Permissions** (`/apps/setup/component/security/access-directory`).
14+
15+
- The page shows the same directory and the same per-type lists as before, with the activation switches, Clone and New. Opening an item, creating one, or opening its history still happens in Studio, on the same editor as before.
16+
- Studio's left menu no longer has the "Positions and permissions" entry under Access. On the organization-flows scope (`~org`), the menu's access rows open their lists on the Setup page for a user who can open Setup (`setup.access`); for one who cannot, they open the same lists in Studio as before.
17+
- Old links keep working and, for a user who can open Setup, land on the Setup page in one hop: `/studio/~all/metadata`, a directory type's list (`/studio/~all/metadata/permission?scope=environment`), a bare `/studio/~all/…` address, and the old Setup metadata URLs that led there. Item links under `/studio/~all/metadata/TYPE/NAME` are unchanged. A user who cannot open Setup keeps these addresses in Studio.
18+
- Visibility does not widen. The Setup entry and the page both require `studio.access`, the capability that admitted a user to the directory in Studio, in addition to Setup's own `setup.access`.
19+
- A user who can enter Studio but cannot open Setup → Packages, and has no recent package, now lands on Studio's organization-flows scope (`/studio/~org`) instead of the old directory. This is temporary: the scope retires when the door that moves loose items into a package ships, and the landing is decided again then.
20+
- One new Setup menu label, "Positions and Permissions", in every Setup locale, and one new message for a user without `studio.access`.

‎content/docs/permissions/administrator-guide.mdx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ One rule of thumb: **capability ships with the apps you install — you rarely
196196
author a permission set by hand.** If you are in this section, you've confirmed
197197
no shipped position covers the need.
198198

199-
The permission-set **matrix editor** (Studio → **All metadata** → Permission
200-
Set, then open the set) is a structured spreadsheet — you never hand-write JSON:
199+
The permission-set **matrix editor** (Setup → Access Control → **Positions and
200+
Permissions** → Permission Set, then open the set in Studio's editor) is a
201+
structured spreadsheet — you never hand-write JSON:
201202

202203
- **Object grid** — per object: Create / Read / Update / Delete, lifecycle
203204
bits (Transfer / Restore / Purge), and View All / Modify All, with per-row
@@ -322,7 +323,7 @@ sets can't be edited in place either, but they can be cloned and adjusted
322323
| Users, invitations | Setup → People & Organization → Users / Invitations |
323324
| Business-unit tree | Setup → People & Organization → Business Units |
324325
| Teams | Setup → People & Organization → Teams |
325-
| Positions, permission sets, capabilities: what they grant, and a position's or set's on/off switch | Studio → All metadata |
326+
| Positions, permission sets, capabilities: what they grant, and a position's or set's on/off switch | Setup → Access Control → Positions and Permissions |
326327
| Who holds a position, who holds a permission set | Setup → People & Organization → Position Holders / Permission Set Assignment |
327328
| Sharing rules, record shares | Setup → Access Control |
328329
| Password policy, MFA, lockout, SSO | Setup → Configuration → Authentication |

‎content/docs/permissions/authorization.mdx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,12 @@ only what it owns:
267267
**live** (config); the sets a position distributes are its definition's
268268
`permissionSets`. It owns environment-authored sets and assignments — not
269269
package sets. The set **definition** has one authoritative store, the
270-
metadata layer (ADR-0094 D1, ADR-0131 D3): Studio's **All metadata** area
271-
lists the catalog (`/studio/~all/metadata/permission?scope=environment`;
272-
Setup carries no metadata catalog, and its old
273-
`/apps/setup/metadata/permission` address redirects there), and a create or
274-
edit there is a metadata save (`PUT /api/v1/meta/permission/:name`) into the
270+
metadata layer (ADR-0094 D1, ADR-0131 D3): Setup → Access control →
271+
**Positions and Permissions** lists the catalog
272+
(`/apps/setup/component/security/access-directory/permission?scope=environment`;
273+
the old environment-scope lists in Studio and Setup, the addresses ending in
274+
`?scope=environment`, redirect there for anyone who can open Setup), a set opens in
275+
Studio's editor, and a create or edit there is a metadata save (`PUT /api/v1/meta/permission/:name`) into the
275276
environment's definition ledger (`sys_metadata`), served from the registry
276277
beside the packages' sets. No row mirrors it: the `sys_permission_set`
277278
object is no longer registered, so no data route serves one. The save

‎content/docs/permissions/permission-sets.mdx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,12 @@ layer — a package's declaration, or a definition authored in this system
423423
and saved in `sys_metadata` — served by name from the security catalog.
424424
Nothing mirrors it into a row: the `sys_permission_set` record ADR-0094 kept
425425
as a projection is retired, its object is no longer registered, and no data
426-
route serves it (ADR-0131 D3). Studio's All metadata area lists the catalog
427-
(`/studio/~all/metadata/permission?scope=environment`; Setup's old
428-
`/apps/setup/metadata/permission` address redirects there), a grant
426+
route serves it (ADR-0131 D3). Setup → Access control → Positions and
427+
Permissions lists the catalog
428+
(`/apps/setup/component/security/access-directory/permission?scope=environment`;
429+
the old environment-scope lists in Studio and Setup, the addresses ending in
430+
`?scope=environment`, redirect there for anyone who can open Setup, and a set
431+
opens in Studio's editor), a grant
429432
names its set by its package and name (`sys_user_permission_set.permission_set_package`
430433
and `permission_set`), and a write
431434
goes through the metadata door (`PUT` or `DELETE /api/v1/meta/permission/:name`),

‎packages/platform-objects/src/apps/setup-nav.contributions.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ export const SETUP_NAV_CONTRIBUTIONS: NavigationContribution[] = [
116116
{ id: 'nav_invitations', type: 'object', label: 'Invitations', objectName: 'sys_invitation', icon: 'mail' },
117117
],
118118
},
119+
{
120+
app: 'setup',
121+
group: 'group_access_control',
122+
// [ADR-0084, amended 2026-11-26, question 5] The environment directory —
123+
// positions, capabilities, permission sets and sharing rules across every
124+
// package — left Studio's menu for this group: Setup holds what is global.
125+
// Priority 100 keeps it first, where plugin-security's catalog entries were.
126+
// Gate: `studio.access`, the Studio entry that admitted a principal to the
127+
// directory before it moved, so moving it widens nobody's view; the Setup
128+
// app's `setup.access` applies on top. Its items still open in Studio
129+
// (ADR-0146 D1). The console binds the ref to its page (app-shell
130+
// `builtinComponents`).
131+
priority: 100,
132+
items: [
133+
{ id: 'nav_access_directory', type: 'component', label: 'Positions and Permissions', componentRef: 'security:access-directory', icon: 'key-round', requiredPermissions: ['studio.access'] },
134+
],
135+
},
119136
{
120137
app: 'setup',
121138
group: 'group_access_control',

‎packages/platform-objects/src/apps/translations/ar.source-hashes.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const arSourceHashes: Readonly<Record<string, string>> = {
101101
'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4',
102102
'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957',
103103
'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490',
104+
'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9',
104105
'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9',
105106
'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55',
106107
'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978',

‎packages/platform-objects/src/apps/translations/ar.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const ar: TranslationData = {
7979
// the same case as the entry above; see `en.ts` (#31123).
8080
nav_scim_credentials: { label: 'بيانات اعتماد SCIM' },
8181
nav_api_keys: { label: 'مفاتيح API' },
82+
nav_access_directory: { label: 'المناصب والأذونات' },
8283

8384
// صندوق الموافقات = the Approvals Inbox component (#7234) — the surface
8485
// with decision actions. The three below are the engine's raw tables; the

‎packages/platform-objects/src/apps/translations/de.source-hashes.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const deSourceHashes: Readonly<Record<string, string>> = {
101101
'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4',
102102
'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957',
103103
'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490',
104+
'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9',
104105
'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9',
105106
'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55',
106107
'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978',

‎packages/platform-objects/src/apps/translations/de.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export const de: TranslationData = {
8080
// of `sys_scim_connection_credential.pluralLabel`.
8181
nav_scim_credentials: { label: 'SCIM-Anmeldedaten' },
8282
nav_api_keys: { label: 'API-Schlüssel' },
83+
nav_access_directory: { label: 'Positionen und Berechtigungen' },
8384

8485
// Genehmigungseingang = the Approvals Inbox component (#7234) — the
8586
// surface with decision actions. The three below are the engine's raw

‎packages/platform-objects/src/apps/translations/en.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export const en: TranslationData = {
121121
// list; the label is the short form of that object's `pluralLabel`.
122122
nav_scim_credentials: { label: 'SCIM Credentials' },
123123
nav_api_keys: { label: 'API Keys' },
124+
nav_access_directory: { label: 'Positions and Permissions' },
124125

125126
// Approvals. `nav_approvals_inbox` is the working surface (#7234); the
126127
// three below it are the engine's raw tables, kept as the admin view.

0 commit comments

Comments
 (0)