From 8d90250cc276a141fe23fddf96efd047c9707740 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 15:58:54 +0000 Subject: [PATCH 1/4] docs(setup,studio): correct the two overview pages and add three Setup manual pages The Setup overview taught the retired role model and the Studio overview said a draft is visible only to its author until published. Both are rewritten from the code: positions and business units, and a Save that is live at once. Three administrator pages join the Setup manual under the setup_ prefix its book claims: going live, who can see and do what, and installing and upgrading apps. English and zh in each item. Claude-Session: https://claude.ai/code/session_016WV4cyCTeavBDbQmtMEQeS Co-authored-by: Claude --- packages/apps/setup/src/index.ts | 11 +- packages/apps/setup/src/setup-access.doc.ts | 146 ++++++++++++++++ packages/apps/setup/src/setup-go-live.doc.ts | 162 ++++++++++++++++++ .../setup/src/setup-install-upgrade.doc.ts | 160 +++++++++++++++++ packages/apps/setup/src/setup-overview.doc.ts | 85 +++++---- .../apps/studio/src/studio-overview.doc.ts | 125 ++++++++------ 6 files changed, 605 insertions(+), 84 deletions(-) create mode 100644 packages/apps/setup/src/setup-access.doc.ts create mode 100644 packages/apps/setup/src/setup-go-live.doc.ts create mode 100644 packages/apps/setup/src/setup-install-upgrade.doc.ts diff --git a/packages/apps/setup/src/index.ts b/packages/apps/setup/src/index.ts index 2240cdbe3f7..8c040a62577 100644 --- a/packages/apps/setup/src/index.ts +++ b/packages/apps/setup/src/index.ts @@ -18,6 +18,9 @@ import { SETUP_APP, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps'; import { SETUP_OVERVIEW_DOC } from './setup-overview.doc.js'; +import { SETUP_GO_LIVE_DOC } from './setup-go-live.doc.js'; +import { SETUP_ACCESS_DOC } from './setup-access.doc.js'; +import { SETUP_INSTALL_UPGRADE_DOC } from './setup-install-upgrade.doc.js'; import { SETUP_MANUAL_BOOK } from './setup-manual.book.js'; export const SETUP_APP_PACKAGE_ID = 'com.objectstack.setup'; @@ -59,8 +62,10 @@ export class SetupAppPlugin { ...setupAppManifestHeader, apps: [SETUP_APP], navigationContributions: SETUP_NAV_CONTRIBUTIONS, - // ADR-0046 package docs — grouped under "Setup" at /_console/docs. - docs: [SETUP_OVERVIEW_DOC], + // ADR-0046 package docs — grouped under "Setup" at /_console/docs: the + // overview, then the three administrator pages it links to. Each name + // carries the `setup_` prefix `SETUP_MANUAL_BOOK` claims its pages by. + docs: [SETUP_OVERVIEW_DOC, SETUP_GO_LIVE_DOC, SETUP_ACCESS_DOC, SETUP_INSTALL_UPGRADE_DOC], // ADR-0046 §6.7 — the manual claiming those docs, read only by the // callers who may open the Setup app (its `audience`). books: [SETUP_MANUAL_BOOK], @@ -74,5 +79,5 @@ export function createSetupAppPlugin(): SetupAppPlugin { } export { SETUP_APP, SETUP_NAV_CONTRIBUTIONS }; -export { SETUP_OVERVIEW_DOC }; +export { SETUP_OVERVIEW_DOC, SETUP_GO_LIVE_DOC, SETUP_ACCESS_DOC, SETUP_INSTALL_UPGRADE_DOC }; export { SETUP_MANUAL_BOOK }; diff --git a/packages/apps/setup/src/setup-access.doc.ts b/packages/apps/setup/src/setup-access.doc.ts new file mode 100644 index 00000000000..cbd6f6a1b42 --- /dev/null +++ b/packages/apps/setup/src/setup-access.doc.ts @@ -0,0 +1,146 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { Doc } from '@objectstack/spec/system'; + +/** + * Setup manual, "Who can see and do what" (ADR-0046): how access adds up, + * object permission against record visibility against field security, and + * how to find out why someone cannot see or edit a record. + * + * Same authoring rule as `setup-overview.doc.ts`. Read off: the grant + * resolver (`resolveUserAuthzGrants`, `@objectstack/core`), the explain + * engine and field masking in `@objectstack/plugin-security`, the sharing + * rule's access levels in `@objectstack/plugin-sharing`, the pending-approval + * lock in `@objectstack/plugin-approvals`, and the closed-state lock in + * `@objectstack/objectql`. `manual-claims-docs.test.ts` pins the menu paths. + */ +export const SETUP_ACCESS_DOC: Doc = { + name: 'setup_access', + label: 'Who can see and do what', + description: + 'How access adds up, the difference between object permission and record visibility, and how to find out why someone cannot see or edit a record.', + order: 2, + content: `# Who can see and do what + +> **Editions.** Letting a permission set reach records by business unit (read +> scope "unit" and the other hierarchy scopes) needs the enterprise edition. On +> the open edition, business units still decide who a sharing rule reaches. +> Everything else on this page is the same on every edition. + +## Access adds up + +A person's access is the union of three sources: + +- the permission sets handed out by each **position** they hold + (**Setup → Access & Sharing → Position Holders**); +- the permission sets granted to them directly + (**Setup → Access & Sharing → Permission Set Assignment**); +- the baseline permission sets every signed-in member gets. + +No permission set takes access away. To restrict someone, do not grant. +A position has no access of its own: it only names the permission sets its +holders receive. A position or permission set that is switched off grants +nothing. + +## Three separate questions + +**1. May this person use this object at all?** Create, read, edit and delete +on an object come from a permission set. + +**2. Which records of it do they reach?** That starts from the object's +**Who can see which records** setting in Studio: *Only the owner can see* (the +default), *Everyone can see*, *Everyone can see and edit*, or *Follows its +parent record*. From there access is only widened: + +- **Sharing rules** and **record shares** (**Setup → Access & Sharing → + Sharing Rules** and **Record Shares**) give more people *read*, or *read and + edit*. They never give delete or change of owner. +- **View All** and **Modify All** on a permission set skip the ownership and + sharing checks for that object. + +**3. Which fields do they read and edit?** A field hidden by field security is +removed from what the person is served, so it looks absent, not locked. Field +rules add up across a person's permission sets, and the most permissive one +wins. **View All** and **Modify All** reach every record but do not open a +hidden field. + +## "I can't see it" or "I can't edit it" + +**Ask the platform first.** **Explain access** runs the same evaluation the +platform enforces and reports what each step contributed: which permission set +granted, through which position, and which sharing rule widened. Give it a +record and it says whether that record is visible and which step decided. +It is in Studio, on a permission set's page and on a package's **Who can see +which records** page; **Setup → Access & Sharing → Positions and Permissions** +opens permission sets there. Explaining another user needs the \`manage_users\` +capability, or a delegated administration scope that covers that user. + +Then check the cases a permission cannot fix: + +- **An approval is in progress.** An approval can lock the record it is + deciding. While it does, the record and the lines under it refuse edits + until the approval is complete. +- **The record is closed.** A record in one of its object's closed states is + final. It and its lines cannot be edited or deleted, and no permission opens + it. +- **A field is missing.** Field security hides it (question 3 above). +- **A new user sees almost nothing.** They hold no position yet. +- **Access disappeared after a move.** Access shared with a business unit + follows membership: a person who leaves the unit loses it. +`, + translations: { + zh: { + label: '谁能看到什么、做什么', + description: + '访问权限如何叠加,对象权限与记录可见性有何区别,以及如何查明某人为什么看不到或改不了某条记录。', + content: `# 谁能看到什么、做什么 + +> **版本说明。** 让权限集按业务单元读取记录(读取范围「unit」及其他层级范围)需要企业版。 +> 在开源版中,业务单元仍然决定共享规则能覆盖到谁。 +> 本页其余内容在所有版本中都一样。 + +## 访问权限是叠加的 + +一个人的访问权限是三个来源的并集: + +- 他所担任的每个**岗位**所发放的权限集 + (**系统设置 → 权限与共享 → 岗位成员**); +- 直接授予他的权限集 + (**系统设置 → 权限与共享 → 权限集授权**); +- 每位已登录成员都有的基线权限集。 + +没有任何权限集会收回访问权限。要限制某人,就不要授予。 +岗位本身没有任何访问权限:它只是列出其成员会获得的权限集。 +已停用的岗位或权限集不授予任何权限。 + +## 三个相互独立的问题 + +**1. 这个人能不能使用这个对象?** 对象的创建、读取、编辑和删除权限来自权限集。 + +**2. 他能触及该对象的哪些记录?** 这从应用搭建中该对象的**谁能看到哪些记录**设置开始:*只有负责人能看*(默认)、*所有人能看*、*所有人都能看和改*,或*跟随所属的主记录*。 +在此基础上,访问范围只会被放宽: + +- **共享规则**和**共享明细**(**系统设置 → 权限与共享 → 共享规则**和**共享明细**)让更多人获得*读取*权限,或*读取和编辑*权限。它们从不授予删除或更改负责人的权限。 +- 权限集上的**查看所有记录**和**修改所有记录**会跳过该对象的所有权检查和共享检查。 + +**3. 他能读取和编辑哪些字段?** 被字段安全隐藏的字段,会从提供给该用户的内容中移除,所以看起来是不存在,而不是被锁定。字段规则会在一个人的多个权限集之间叠加,取最宽松的一条。 +**查看所有记录**和**修改所有记录**能触及每一条记录,但不会打开被隐藏的字段。 + +## 「我看不到」或「我改不了」 + +**先问平台。** **解释访问权限**会运行与平台实际执行完全相同的评估,并报告每一步的贡献:哪个权限集授予了权限,通过哪个岗位,哪条共享规则放宽了范围。 +给它一条记录,它会告诉你这条记录是否可见,以及由哪一步决定。 +它位于应用搭建中,在权限集的页面上,也在软件包的**谁能看到哪些记录**页面上;**系统设置 → 权限与共享 → 岗位与权限**会在那里打开权限集。 +解释其他用户需要 \`manage_users\` 能力,或覆盖该用户的委托管理范围。 + +然后检查权限无法解决的情况: + +- **审批正在进行。** 审批可以锁定它正在裁决的记录。在此期间,该记录及其下的明细行都拒绝编辑,直到审批完成。 +- **记录已关闭。** 处于其对象的某个关闭状态的记录是最终状态。它和它的明细行不能被编辑或删除,任何权限都无法打开它。 +- **字段缺失。** 字段安全把它隐藏了(见上面的问题 3)。 +- **新用户几乎什么都看不到。** 他们还没有担任任何岗位。 +- **调动后访问权限消失。** 共享给业务单元的访问权限跟随成员关系:离开该单元的人会失去它。 +`, + }, + }, +}; diff --git a/packages/apps/setup/src/setup-go-live.doc.ts b/packages/apps/setup/src/setup-go-live.doc.ts new file mode 100644 index 00000000000..53d9338911c --- /dev/null +++ b/packages/apps/setup/src/setup-go-live.doc.ts @@ -0,0 +1,162 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { Doc } from '@objectstack/spec/system'; + +/** + * Setup manual, "Going live" (ADR-0046): the order a new organization is set + * up in and why, why a new user sees almost nothing, what a pending + * invitation is, and what a ban does and does not do. + * + * Same authoring rule as `setup-overview.doc.ts`: only what the screens do not + * show, and every statement read off the code that enforces it — + * `setup-nav.contributions.ts` (the menu paths), the `auth`, `access_policy` + * and `localization` settings manifests in `@objectstack/service-settings`, + * and `sys_invitation` / `sys_user` / `sys_business_unit` in + * `@objectstack/platform-objects`. `manual-claims-docs.test.ts` pins the menu + * paths and the action and status names against those declarations. + */ +export const SETUP_GO_LIVE_DOC: Doc = { + name: 'setup_go_live', + label: 'Going live: first-week setup', + description: + 'The order to set up a new organization in, why a new user sees almost nothing, what a pending invitation is, and what a ban does and does not do.', + order: 1, + content: `# Going live: first-week setup + +> **Editions.** The steps are the same on every edition, with two differences. +> On an environment managed by ObjectOS Cloud, people come from the hosting +> organization's identity provider, so **Invite User** and **Create User** are +> not offered. Letting a permission set read every record of a business unit +> needs the enterprise edition; on the open edition a business unit still +> drives sharing rules. + +## Set up in this order + +Each step is used by the one after it. + +1. **Company and region.** Fill in **Setup → Users & Organization → Company + Information**, then **Setup → Company Settings → Language & Region**. The + default timezone there decides what "today" means in formulas, how reports + group dates, and how dates and times are shown, so set it before people + enter data. +2. **Business units.** Build the tree in **Setup → Users & Organization → + Business Units**. Sharing rules can share records with a unit, or with a + unit and the units under it: its members get that access, and lose it when + they leave the unit. A unit that still has units under it cannot be deleted. +3. **Apps and positions.** Install the apps you will use before you invite + anyone: an app brings its own positions and permission sets + ([Installing and upgrading apps](./setup_install_upgrade.md)). What each one + grants is listed in **Setup → Access & Sharing → Positions and Permissions**. +4. **People.** Invite from **Setup → Users & Organization → Invitations**, then + give each person a position in **Setup → Access & Sharing → Position + Holders**. Check **Setup → Notifications → Email Channel** before the first + invitation: on a server that delivers no mail, no email goes out, and only + an invitee whose social or SSO sign-in verifies their address can accept. + For anyone else, a platform administrator creates the account with + **Create User**. +5. **Sign-in rules.** **Setup → Login & Security → Sign-in Methods** applies to + the whole deployment and is shown to platform administrators only. Nothing + above waits on it: by default people sign in with email and password, and + nobody can register without an invitation. **Access policy**, in the same + group, belongs to one organization and can only add restrictions to the + deployment's; it never loosens them. + +## A new user sees almost nothing + +That is the baseline working, not a fault. + +- A person who has just joined holds only the permission sets every member + gets. Access to an app's records arrives when you give them a position. +- The **Role** you choose in the invitation is the organization membership + level (owner, admin, member and so on). It is not a position. A member works + in the apps with the access their permission sets give; an admin also + manages members, invitations, teams and organization settings. +- A position or permission set that is switched off grants nothing to the + people who hold it. + +## An invitation that has not been accepted + +- The person is not a member yet. They join, with the role you chose, when + they accept. +- The invitation stays under **Pending** until it is accepted, declined or + canceled, or until it expires. +- **Resend Invitation** starts the expiry date over. An invitation that has + already expired is replaced by a new one. +- **Copy Invite Link** is offered on a pending invitation that has not + expired. Anyone who opens the link can accept the invitation, so share it + only with the person you invited. It stops working once the invitation is + accepted, declined, canceled or expired. + +## When someone leaves: ban, do not delete + +- **Ban User** signs the person out and blocks sign-in. Their API keys, OAuth + access tokens and token refreshes are refused while the ban holds. +- A ban moves no records. Everything the person owns stays theirs until you + change the owner. +- Once banned, the person cannot be set as the owner or assignee of a record. + Records that already name them stay editable. +- **Unban User** restores sign-in and API keys. It does not restore three + things the ban also switched off: the AI service accounts the person is + accountable for, the OAuth applications they registered, and the SCIM + credentials they created. +- Only platform administrators are offered **Ban User**. An organization + administrator does not see it. +`, + translations: { + zh: { + label: '上线:第一周的设置', + description: + '新组织的设置顺序,新用户为什么几乎什么都看不到,待处理邀请是什么,以及封禁能做什么、不能做什么。', + content: `# 上线:第一周的设置 + +> **版本说明。** 各步骤在所有版本中都一样,只有两处差异。 +> 在由 ObjectOS Cloud 托管的环境中,人员来自托管组织的身份提供方,因此不提供**邀请用户**和**创建用户**。 +> 让权限集读取某个业务单元的全部记录需要企业版;在开源版中,业务单元仍然驱动共享规则。 + +## 按此顺序设置 + +每一步都会被后面的步骤用到。 + +1. **公司与区域。** 填写**系统设置 → 用户与组织 → 公司信息**,然后填写**系统设置 → 公司设置 → 语言与区域**。 + 那里的默认时区决定公式中「今天」的含义、报表如何按日期分组,以及日期和时间如何显示,所以请在大家录入数据之前设置好。 +2. **业务单元。** 在**系统设置 → 用户与组织 → 业务单元**中建立树状结构。 + 共享规则可以把记录共享给某个单元,或某个单元及其下级单元:其成员获得这些访问权限,离开该单元时即失去。 + 仍有下级单元的单元不能删除。 +3. **应用与岗位。** 在邀请任何人之前,先安装你要用的应用:应用会带来它自己的岗位和权限集 + ([安装与升级应用](./setup_install_upgrade.md))。 + 每个岗位和权限集授予了什么,列在**系统设置 → 权限与共享 → 岗位与权限**中。 +4. **人员。** 在**系统设置 → 用户与组织 → 邀请**中发出邀请,然后在**系统设置 → 权限与共享 → 岗位成员**中为每个人指定岗位。 + 第一次发出邀请前,请检查**系统设置 → 消息通知 → 邮件通道**:在不投递邮件的服务器上,不会发出任何邮件,只有通过社交或 SSO 登录且地址已被验证的受邀人才能接受邀请。 + 对其他人,由平台管理员用**创建用户**创建账号。 +5. **登录规则。** **系统设置 → 登录与安全 → 登录方式**适用于整个部署,并且只向平台管理员显示。 + 以上步骤都不必等它:默认情况下,人们用邮箱和密码登录,没有邀请任何人都不能注册。 + 同一分组中的**访问策略**属于某一个组织,并且只能在部署级策略之上增加限制,绝不会放宽。 + +## 新用户几乎什么都看不到 + +这是基线在正常工作,不是故障。 + +- 刚加入的人只拥有每位成员都有的权限集。要获得某个应用中记录的访问权限,需要你给他指定岗位。 +- 你在邀请中选择的**角色**是组织成员级别(所有者、管理员、成员等),不是岗位。 + 成员凭其权限集给予的访问权限在应用中工作;管理员还可以管理成员、邀请、团队和组织设置。 +- 已停用的岗位或权限集不会给担任该岗位或持有该权限集的人授予任何权限。 + +## 尚未被接受的邀请 + +- 这个人还不是成员。他在接受邀请时,以你选择的角色加入。 +- 邀请会一直留在**待处理**下,直到被接受、拒绝或取消,或者过期。 +- **重新发送邀请**会让有效期重新开始计算。已经过期的邀请会被一份新邀请取代。 +- 对尚未过期的待处理邀请,会提供**复制邀请链接**。任何打开该链接的人都可以接受邀请,所以只把它分享给你邀请的人。 + 邀请被接受、拒绝、取消或过期后,链接就会失效。 + +## 有人离开时:封禁,不要删除 + +- **封禁用户**会让此人登出并禁止登录。封禁期间,其 API 密钥、OAuth 访问令牌和令牌续期都会被拒绝。 +- 封禁不会转移任何记录。此人拥有的一切仍归其所有,直到你更改负责人。 +- 一旦被封禁,此人就不能被设为记录的负责人或经办人。已经指定了他的记录仍然可以编辑。 +- **解除封禁**会恢复登录和 API 密钥。封禁同时停用的三样东西不会恢复:此人所负责的 AI 服务账号、他注册的 OAuth 应用,以及他创建的 SCIM 凭据。 +- 只有平台管理员才能使用**封禁用户**。组织管理员看不到它。 +`, + }, + }, +}; diff --git a/packages/apps/setup/src/setup-install-upgrade.doc.ts b/packages/apps/setup/src/setup-install-upgrade.doc.ts new file mode 100644 index 00000000000..281e788ee3a --- /dev/null +++ b/packages/apps/setup/src/setup-install-upgrade.doc.ts @@ -0,0 +1,160 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { Doc } from '@objectstack/spec/system'; + +/** + * Setup manual, "Installing and upgrading apps" (ADR-0046): what an install + * adds, what an update keeps and asks to confirm, why no earlier version can + * be put back, and what uninstall, disable and delete leave behind. + * + * Same authoring rule as `setup-overview.doc.ts`. Read off the console's + * marketplace pages (`ui/packages/app-shell/src/console/marketplace/`) and + * their strings, the control-plane address rule in + * `@objectstack/cloud-connection` (`cloud-url.ts`), and the marketplace menu + * entry (`marketplace-ui.ts`). The edition differences sit at the top of the + * page. `manual-claims-docs.test.ts` pins the menu paths. + */ +export const SETUP_INSTALL_UPGRADE_DOC: Doc = { + name: 'setup_install_upgrade', + label: 'Installing and upgrading apps', + description: + 'What an install adds, what an update keeps and changes, why there is no going back to an earlier version, and what uninstall leaves behind.', + order: 3, + content: `# Installing and upgrading apps + +> **Editions.** The app catalog is served by a cloud control plane. +> **Open edition:** a runtime browses the public catalog unless its operator +> points \`OS_CLOUD_URL\` elsewhere. **Enterprise, self-hosted:** the deployment +> template starts with \`OS_CLOUD_URL=off\`. Setup then has no **Browse +> Marketplace** entry and the marketplace page reads **App Marketplace is +> turned off**; an operator turns it on by pointing \`OS_CLOUD_URL\` at a control +> plane and restarting. **ObjectOS Cloud:** the control plane carries out +> installs and updates, and code plugins cannot be installed on a hosted +> environment. + +## Installing + +Find apps in **Setup → Apps & AI → Browse Marketplace**. What is installed is +listed in **Setup → Apps & AI → Installed Apps**. Only organization owners and +admins can install. + +- **An app can ask for more than objects.** Some suggest granting one of their + permission sets to all signed-in users (the Everyone position). Nothing is + granted until you accept, and you can revoke it later. +- **Sample records are real records.** They load so you can see the app + working. Clear them when you start using the app for real. Clearing deletes + only the sample records, never records people added. Installing again does + not bring cleared sample records back; **Re-seed sample data** does. +- **Install mode, where the app offers a choice.** *Managed* keeps the package + in charge: it receives upgrades and its items are not edited here. + *Unmanaged copy* copies it once as your own metadata: every item is + editable, and the copy receives no upgrade. +- **An app can change objects that already exist.** The install dialog lists + them. Platform objects are shared by every app, so a change to one can + affect sign-in, user profiles and other apps. + +## Upgrading + +An installed app shows **Update available** when the catalog lists a higher +version. + +- **Your customizations are kept.** An update replaces only the package's own + metadata. Changes you made to the app are saved in its customization + package and stay as they are. +- **Changes to fields that hold data must be confirmed.** The update dialog + lists each one, with the number of records holding a value where it could + be counted: + - *A field is removed and another added, with no rename declared.* The new + field starts empty, and the existing values stay in a column nothing + reads. + - *A field changes type.* The existing values stay as stored and are not + converted. + - *A field changes to a type that stores no column.* The existing values are + no longer read. +- **Changes to access must be confirmed too**, when an update changes what + access choices made in this environment cover. +- **A major version** (the first number changes) may include breaking changes; + the dialog says so and links the release notes. + +## There is no going back to an earlier version + +An update is only ever offered to a higher version, and nothing in the product +puts an earlier version of an app back. What you can undo is your own work: + +- **Restore package original** on an item you customized deletes your + customization, and the package's version is served again. +- An item's **History** in Studio can roll that item back to an earlier + version of your customization. + +So read the confirmation list before you accept an update. + +## Removing an app + +- **Uninstall** takes the app out of service at once, together with its + permission sets and the grants of them. Records stored in its objects stay + in the database. +- **Disable**, in Installed Apps, takes the package out of service for every + user until it is enabled again. No records are deleted. It is refused while + an active validation rule reads a field the package adds. +- **Delete package** asks what happens to the records: keep them, or delete + the tables with every record in them. It cannot be undone. +`, + translations: { + zh: { + label: '安装与升级应用', + description: + '安装会增加什么,更新会保留什么、改变什么,为什么无法回到更早的版本,以及卸载会留下什么。', + content: `# 安装与升级应用 + +> **版本说明。** 应用目录由云端控制面提供。 +> **开源版:** 运行时浏览公共目录,除非其运维人员把 \`OS_CLOUD_URL\` 指向别处。 +> **企业版,自托管:** 部署模板以 \`OS_CLOUD_URL=off\` 启动。此时系统设置中没有**浏览应用市场**入口,应用市场页面显示**应用市场已关闭**;运维人员把 \`OS_CLOUD_URL\` 指向某个控制面并重启,即可将其开启。 +> **ObjectOS Cloud:** 由控制面执行安装和更新,托管环境上不能安装代码插件。 + +## 安装 + +在**系统设置 → 应用与 AI → 浏览应用市场**中查找应用。 +已安装的内容列在**系统设置 → 应用与 AI → 已安装应用**中。 +只有组织所有者和管理员可以安装。 + +- **应用要求的可以不止对象。** 有些应用建议把它们的某个权限集授予所有已登录用户(全体成员岗位,即 Everyone)。 + 在你接受之前不会授予任何权限,之后你也可以撤销。 +- **示例记录是真实的记录。** 加载它们是为了让你看到应用在运行。开始正式使用应用时请清除它们。 + 清除只会删除示例记录,绝不会删除人们添加的记录。 + 再次安装不会把已清除的示例记录带回来;**重新加载示例数据**才会。 +- **安装方式,在应用提供选择的情况下。** *托管*让软件包保持权威:它接收升级,其中的条目不在此处编辑。 + *非托管副本*把它一次性复制为你自己的元数据:每个条目都可编辑,副本不再接收升级。 +- **应用可以改动已经存在的对象。** 安装对话框会列出它们。 + 平台对象由所有应用共用,因此对其中一个的改动可能影响登录、用户资料和其他应用。 + +## 升级 + +当目录中列出更高的版本时,已安装的应用会显示**有可用更新**。 + +- **你的定制会被保留。** 更新只替换软件包自己的元数据。你对应用所做的改动保存在它的定制包中,保持原样。 +- **对存有数据的字段的改动必须确认。** 更新对话框会逐条列出,并在能统计时给出持有值的记录数: + - *删除了一个字段并新增了另一个,且没有声明重命名。* 新字段从空开始,原有的值留在一个没有任何东西读取的列中。 + - *字段更改了类型。* 原有的值按存储时的样子保留,不会被转换。 + - *字段更改为不存储列的类型。* 原有的值不再被读取。 +- **对访问权限的改动也必须确认**,当更新改变了在此环境中所做的访问选择所覆盖的范围时。 +- **主版本**(第一位数字变化)可能包含破坏性变更;对话框会说明这一点,并链接到发布说明。 + +## 无法回到更早的版本 + +更新只会提供给更高的版本,产品中没有任何功能能把应用恢复到更早的版本。你能撤销的是你自己的工作: + +- 对你定制过的条目使用**恢复软件包原版**,会删除你的定制,重新提供软件包的版本。 +- 在应用搭建中,条目的**历史**可以把该条目回滚到你定制的更早版本。 + +所以,在接受更新之前,请先阅读确认清单。 + +## 移除应用 + +- **卸载**会立即让应用停止服务,连同它的权限集以及这些权限集的授权。存放在其对象中的记录仍保留在数据库里。 +- 在已安装应用中**禁用**,会让软件包对所有用户停止服务,直到重新启用。不会删除任何记录。 + 如果某条处于启用状态的验证规则读取了该软件包新增的字段,禁用会被拒绝。 +- **删除软件包**会询问如何处理记录:保留它们,或者删除这些表及其中的所有记录。此操作无法撤销。 +`, + }, + }, +}; diff --git a/packages/apps/setup/src/setup-overview.doc.ts b/packages/apps/setup/src/setup-overview.doc.ts index 4df0c57ee21..5ab5747962a 100644 --- a/packages/apps/setup/src/setup-overview.doc.ts +++ b/packages/apps/setup/src/setup-overview.doc.ts @@ -13,9 +13,15 @@ import type { Doc } from '@objectstack/spec/system'; * images/MDX, per ADR-0046 §3.4. * * Principle (from the HotCRM reference docs): document only the *invisible* - * rules, not what the Setup UI already shows. Deliberately three short bullets — - * the Users/Roles/Permission-set screens cover the rest; this page exists for - * the handful of behaviours those screens don't reveal. + * rules, not what the Setup UI already shows. Deliberately a few short bullets: + * the Users, Business Units, Position Holders and Permission Set Assignment + * screens cover the rest, and the three pages this one links to (go-live, + * access, install and upgrade) carry the detail. + * + * The vocabulary is the platform's: permission set = capability, position = + * who gets which sets (flat, no parent), business unit = the one hierarchy. + * `manual-claims-docs.test.ts` holds every Setup menu path named here to the + * app's own labels, in both languages. * * `translations` carries per-locale variants (ADR-0046 i18n); the REST layer * collapses the doc to the request's `Accept-Language` and serves one body. @@ -23,47 +29,60 @@ import type { Doc } from '@objectstack/spec/system'; export const SETUP_OVERVIEW_DOC: Doc = { name: 'setup_overview', label: 'Setup overview', - description: 'The non-obvious rules behind Setup: identity vs access, additive permissions, and record visibility.', + description: + 'The rules behind Setup that its screens do not show: identity vs access, additive permissions, flat positions, and record visibility.', content: `# Setup overview -Setup is the administrator app. Its screens are mostly self-explanatory — these -are the few rules behind them that the UI does not show. For everything else, -see . +Setup is the administrator app. Its screens mostly explain themselves. These +are the rules behind them that the screens do not show. -- **A user is identity, not access.** Creating a \`sys_user\` lets someone sign - in; *what* they can do comes entirely from the roles and permission sets you - then assign. Deactivating a user revokes sign-in without deleting their +- **A user is identity, not access.** A user record lets someone sign in. What + they can do comes from the positions they hold and the permission sets those + positions hand out. Banning a user blocks sign-in and moves none of their records, so ownership and history survive. -- **Access is additive.** A user's effective permissions are the *union* of - every permission set granted to them — you grant capability, you never - subtract it. -- **"Can't see a record" is almost always sharing, not permissions.** - Object-level permissions decide which *kinds* of records a user can touch; - sharing decides *which rows*. Visibility starts from the org-wide default and - is only ever widened by the role hierarchy and sharing rules — never silently - narrowed. +- **Access is additive.** A user's access is the union of every permission set + they reach: through their positions, through direct grants, and through the + baseline every member gets. You grant access; nothing subtracts it. +- **Positions are flat. The hierarchy is the business-unit tree.** A position + is a job function that hands out permission sets. It has no parent and no + reporting line. Company structure lives in **Setup → Users & Organization → + Business Units**. +- **"Can't see a record" is usually about which records, not which objects.** + Object permissions decide which kinds of records a user works with. Which + records of that kind they reach starts from the object's + **Who can see which records** setting and is widened by sharing rules and + record shares. + +More in this manual: -See for the full security model. +- [Going live: first-week setup](./setup_go_live.md) +- [Who can see and do what](./setup_access.md) +- [Installing and upgrading apps](./setup_install_upgrade.md) `, translations: { zh: { - label: 'Setup 概览', - description: 'Setup 背后看不见的几条规则:身份≠权限、权限叠加、记录可见性。', - content: `# Setup 概览 + label: '系统设置概览', + description: + '系统设置背后、界面上看不到的规则:身份与访问、叠加的权限、扁平的岗位,以及记录可见性。', + content: `# 系统设置概览 + +系统设置是管理员应用。它的界面大多一目了然。 +下面是界面背后、界面上看不到的规则。 -Setup 是管理员应用。它的界面大多一目了然——下面这几条是界面背后、UI 没有明说的 -规则。其余内容见 。 +- **用户是身份,不是访问权限。** 用户记录让某人能够登录。他能做什么,取决于他所担任的岗位,以及这些岗位发放的权限集。 + 封禁用户会禁止登录,但不会转移他的任何记录,所以所有权和历史都得以保留。 +- **访问权限是叠加的。** 用户的访问权限是他能触及的所有权限集的并集:通过岗位、通过直接授权,以及通过每位成员都有的基线。 + 你只负责授予访问权限,没有任何东西会减去它。 +- **岗位是扁平的,层级是业务单元树。** 岗位是发放权限集的职能。它没有上级,也没有汇报关系。 + 公司结构位于**系统设置 → 用户与组织 → 业务单元**。 +- **「看不到记录」通常是哪些记录的问题,而不是哪些对象的问题。** + 对象权限决定用户处理哪些种类的记录。他能触及该种类的哪些记录,从该对象的**谁能看到哪些记录**设置开始,并由共享规则和共享明细放宽。 -- **用户是身份,不是权限。** 创建一条 \`sys_user\` 只是让人能登录;他*能做什么* - 完全由你随后分配的角色和权限集决定。停用用户会收回登录权,但不删除其记录, - 归属与历史因此得以保留。 -- **权限是叠加的。** 用户的最终权限是其所有权限集的*并集*——你是在授予能力, - 从不做减法。 -- **"看不到某条记录"几乎总是共享问题,不是权限问题。** 对象级权限决定用户能碰 - *哪类*记录;共享决定*哪些行*。可见性从组织级默认出发,只会被角色层级和共享规则 - *放宽*,绝不会被悄悄收窄。 +本手册中的更多内容: -完整安全模型见 。 +- [上线:第一周的设置](./setup_go_live.md) +- [谁能看到什么、做什么](./setup_access.md) +- [安装与升级应用](./setup_install_upgrade.md) `, }, }, diff --git a/packages/apps/studio/src/studio-overview.doc.ts b/packages/apps/studio/src/studio-overview.doc.ts index 435b6e25f2b..88ca39a6dd8 100644 --- a/packages/apps/studio/src/studio-overview.doc.ts +++ b/packages/apps/studio/src/studio-overview.doc.ts @@ -15,80 +15,109 @@ import type { Doc } from '@objectstack/spec/system'; * Principle (from the HotCRM reference docs): document the *invisible* * business logic, not what the Studio UI already shows on screen. * + * What the page states is read off the console: a Save writes the item's draft + * and publishes it in the same act (`publishSavedItem`, `studioSaveBar.tsx`), + * so nothing here is a private draft; only the AI assistant's drafts wait, on + * the package Overview's Pending tab (`StudioPackageOverviewPage.tsx`); and a + * read-only package's changes are held by its paired customization package. + * * `translations` carries per-locale variants (ADR-0046 i18n); the REST layer * collapses the doc to the request's `Accept-Language` and serves one body. */ export const STUDIO_OVERVIEW_DOC: Doc = { name: 'studio_overview', label: 'Studio overview', - description: 'Orientation for builders: the metadata-first model, overlay precedence, and publishing.', + description: + 'Orientation for builders: you edit definitions, a Save is live for everyone at once, and changes to a shipped app are kept beside it.', content: `# Studio overview -Studio is the builder app — the workbench for shaping the platform's -*metadata*: objects, fields, views, flows, agents, and the rest. Most of its -screens are self-explanatory; this page covers the one rule that is not visible -on screen but governs everything you do here. For the full reference, see -. +> **Editions.** The AI assistant is not part of the open edition. Where this +> page mentions drafts written by the assistant, it applies to editions that +> include one. + +Studio is the builder app: the workbench for an app's objects, fields, views, +flows, permission sets and the rest. Its screens mostly explain themselves. +This page covers the rules they do not show. + +## You edit definitions, not a database + +Every object, field and view is a definition, and the running app is generated +from those definitions. That is why one change in Studio reshapes the screens +and the API together. + +## A Save is live for everyone at once -## Metadata-first +There is no private draft and no review step for your own edits. -In Studio you do not edit a running database — you edit *definitions*. Every -object, field, and view is a metadata record, and the live application is -generated from that metadata. This is why a change in Studio can reshape the UI -and the API at once: you are changing the model, not patching a screen. +- **Save publishes.** The change is live for every user as soon as the Save + lands. +- **Risky saves ask first.** A Save that would remove a published field, or + change its type, names each change and what it does to existing records + before anything is written. +- **Two people on the same item.** If someone else published the item after + you opened it, your Save is not applied over theirs: you are asked to reload + or to overwrite. +- **The AI assistant's changes wait.** Changes the assistant drafts do not go + live on their own. They wait on the **Pending** tab of the package's + **Overview** page until you review and publish them. +- **Revert to last publish is not an undo.** It discards changes that were + never published. It does not take back a publish. -## Edits are overlays (the invisible rule) +## A shipped app is read-only; your changes are kept beside it -Your changes do not mutate the metadata shipped by a package in place. Studio -writes an **overlay** on top of the base definition, and the runtime resolves -the two by precedence: an unpublished **draft** wins for you while you work, a -published **tenant overlay** wins over the package's baseline, and the package -baseline is the fallback (ADR-0005, ADR-0033). The practical consequence: the -base definition is never destroyed, so an overlay can always be reverted to -recover the original — and a field that "won't change" is usually being shadowed -by a higher-precedence layer. +A package an app shipped cannot be changed directly. When you change something +in it, your version is saved in the app's own customization package and served +in place of the shipped one. -## Publishing & deploying +- The shipped version is never altered, so an update to the app keeps your + changes (see *Installing and upgrading apps* in the Setup manual). +- **Restore package original** deletes your customization of an item, and the + package's version is served again. -A draft is visible only to you until you **publish** it, which promotes the -overlay so the rest of the tenant sees it. Moving changes between environments -(for example dev → production) is a separate **deploy** step, not an automatic -side effect of publishing — keeping the two distinct is what lets you build -safely in one environment before shipping. +## Moving work to another environment -See for drafts, overlays, and deployment in depth. +Nothing you save here reaches another environment. To move it, use **Export** +on the package's **Overview** page and import the file in the other +environment's Studio. `, translations: { zh: { - label: 'Studio 概览', - description: '搭建者入门:元数据优先模型、覆盖层优先级、发布与部署。', - content: `# Studio 概览 + label: '应用搭建概览', + description: + '面向搭建者的导览:你编辑的是定义,保存会立即对所有人生效,对应用自带内容的改动保存在它旁边。', + content: `# 应用搭建概览 + +> **版本说明。** 开源版不包含 AI 助手。本页提到由助手撰写的草稿之处,适用于包含助手的版本。 + +应用搭建是搭建者应用:用于处理应用的对象、字段、视图、流程、权限集等的工作台。它的界面大多一目了然。 +本页介绍界面上看不到的规则。 + +## 你编辑的是定义,不是数据库 + +每个对象、字段和视图都是一份定义,运行中的应用由这些定义生成。 +所以在应用搭建中的一处改动,会同时改变界面和 API。 -Studio 是搭建者应用——塑造平台*元数据*的工作台:对象、字段、视图、流程、智能体等。 -它的大多数界面一目了然;本页讲的是那条界面上看不见、却支配你在这里一切操作的规则。 -完整参考见 。 +## 保存会立即对所有人生效 -## 元数据优先 +没有私有草稿,你自己的编辑也没有审核步骤。 -在 Studio 里你编辑的不是运行中的数据库,而是*定义*。每个对象、字段、视图都是一条 -元数据记录,运行的应用由这些元数据生成。这就是为什么 Studio 里的一处改动能同时重塑 -UI 和 API:你改的是模型,而不是修补某个界面。 +- **保存即发布。** 保存一完成,改动就对所有用户生效。 +- **有风险的保存会先询问。** 如果某次保存会删除已发布的字段或更改其类型,在写入任何内容之前,会逐条指出每项改动及其对现有记录的影响。 +- **两个人编辑同一个条目。** 如果在你打开该条目之后,别人发布了它,你的保存不会覆盖他们的:系统会询问你是重新加载还是覆盖。 +- **AI 助手的改动需要等待。** 助手起草的改动不会自行生效。它们会在软件包的**概览**页面的**待发布**标签页上等待,直到你审阅并发布。 +- **还原到上次发布不是撤销。** 它会丢弃从未发布的改动,不会撤回已经发布的内容。 -## 编辑即覆盖层(看不见的规则) +## 应用自带的内容是只读的;你的改动保存在它旁边 -你的改动不会原地修改某个包发布的元数据。Studio 在基础定义之上写一层**覆盖层**, -运行时按优先级解析两者:未发布的**草稿**在你编辑时对你生效,已发布的**租户覆盖层** -优先于包的基线,包基线则是兜底(ADR-0005、ADR-0033)。实际后果:基础定义永不被 -销毁,所以覆盖层总能回退以恢复原样——而一个"改不动"的字段,通常是被更高优先级的 -层遮住了。 +应用自带的软件包不能被直接修改。当你改动其中的内容时,你的版本会保存在该应用自己的定制包中,并取代自带的版本提供服务。 -## 发布与部署 +- 自带的版本从不被改动,因此应用的更新会保留你的改动 + (见系统设置手册中的《安装与升级应用》)。 +- **恢复软件包原版**会删除你对某个条目的定制,重新提供软件包的版本。 -草稿只对你自己可见,直到你**发布**它,把覆盖层提升给整个租户看到。在环境之间搬运 -改动(例如开发 → 生产)是单独的**部署**步骤,不是发布的自动副作用——把两者分开, -才能让你在一个环境里安全搭建、再上线。 +## 把工作迁移到另一个环境 -草稿、覆盖层与部署的细节见 。 +你在这里保存的内容不会到达其他环境。要迁移它,请使用软件包**概览**页面上的**导出**,并在另一个环境的应用搭建中导入该文件。 `, }, }, From 1829ecd64450e6db76a7710a60c23ffa514f33fd Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 16:02:27 +0000 Subject: [PATCH 2/4] test(setup,studio): hold the manual pages to the labels their screens show Each Setup menu path a page names is resolved against the Setup app's navigation labels in English and in Chinese, and the two languages must name the same entries in the same order. The going-live page's actions, the Pending list and the Role field are read from the object label bundles. Links between pages must name a registered page. Claude-Session: https://claude.ai/code/session_016WV4cyCTeavBDbQmtMEQeS Co-authored-by: Claude --- .../apps/setup/src/manual-claims-docs.test.ts | 190 +++++++++++++++++- packages/apps/setup/src/setup-access.doc.ts | 4 +- .../setup/src/setup-install-upgrade.doc.ts | 2 +- .../studio/src/manual-claims-docs.test.ts | 39 +++- .../apps/studio/src/studio-overview.doc.ts | 10 +- 5 files changed, 234 insertions(+), 11 deletions(-) diff --git a/packages/apps/setup/src/manual-claims-docs.test.ts b/packages/apps/setup/src/manual-claims-docs.test.ts index b49c97bfcff..455326fd252 100644 --- a/packages/apps/setup/src/manual-claims-docs.test.ts +++ b/packages/apps/setup/src/manual-claims-docs.test.ts @@ -16,11 +16,27 @@ import { describe, expect, it } from 'vitest'; import { resolveDocAudiences, type AudienceBook, type ResolverDoc } from '@objectstack/spec/system'; -import { createSetupAppPlugin, SETUP_APP_PACKAGE_ID, SETUP_MANUAL_BOOK } from './index.js'; +import { en, zhCN, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps'; +import { + createSetupAppPlugin, + SETUP_ACCESS_DOC, + SETUP_APP_PACKAGE_ID, + SETUP_GO_LIVE_DOC, + SETUP_INSTALL_UPGRADE_DOC, + SETUP_MANUAL_BOOK, + SETUP_OVERVIEW_DOC, +} from './index.js'; + +interface RegisteredDoc { + name: string; + label?: string; + content: string; + translations?: Record; +} interface Registered { id: string; - docs: Array<{ name: string; label?: string }>; + docs: RegisteredDoc[]; books: AudienceBook[]; } @@ -56,3 +72,173 @@ describe('setup_manual claims every doc @objectstack/setup registers', () => { expect(audiences.get('unbound_page'), 'the manual claims a doc bound to no package').toEqual(['org']); }); }); + +/** + * The manual's pages name screens, buttons and lists, and a name the product + * does not show sends an administrator looking for a page that is not there. + * Each pin below reads the name from the declaration the screen is drawn from + * (the Setup app's navigation labels and the object labels, per language), so + * a renamed entry turns the page that still uses the old name red, and the + * zh page is held to the labels the zh screens show. + * + * What these cannot hold: the rules a page states about `ui/` (the marketplace + * and Studio screens) and about the security, sharing and approvals plugins. + * This package depends on none of them; each doc's header names the code its + * statements were read from. + */ + +type Labelled = Record; +interface ObjectLabels { + fields?: Labelled; + _actions?: Labelled; + _views?: Labelled; +} +interface Bundle { + apps: { setup: { label: string; navigation: Labelled } }; + objects: Record; +} + +const BUNDLES: Record<'en' | 'zh', Bundle> = { + en: en as unknown as Bundle, + zh: zhCN as unknown as Bundle, +}; + +/** A page's body in one language: the base is English, `translations.zh` the Chinese. */ +function body(doc: RegisteredDoc, locale: 'en' | 'zh'): string { + const text = locale === 'en' ? doc.content : doc.translations?.zh?.content; + expect(text, `${doc.name} has no ${locale} body`).toBeTruthy(); + return text!; +} + +/** Every bold span of a page, with a span wrapped over two lines read as one. */ +function boldSpans(markdown: string): string[] { + return [...markdown.matchAll(/\*\*([^*]+)\*\*/g)].map((m) => m[1]!.replace(/\s*\n\s*/g, ' ').trim()); +} + +/** The navigation id carrying `label` under `prefix`, in one language's bundle. */ +function navIdOf(bundle: Bundle, prefix: 'group_' | 'nav_', label: string): string | undefined { + return Object.entries(bundle.apps.setup.navigation).find(([id, node]) => id.startsWith(prefix) && node?.label === label)?.[0]; +} + +/** + * The menu paths a page names, as `[group id, entry id]`: every bold span that + * opens with the Setup app's own name in that language and an arrow. + */ +function menuPaths(doc: RegisteredDoc, locale: 'en' | 'zh'): Array<[string, string]> { + const bundle = BUNDLES[locale]; + const app = bundle.apps.setup.label; + return boldSpans(body(doc, locale)) + .filter((span) => span.startsWith(`${app} → `)) + .map((span) => { + const parts = span.split(' → '); + expect(parts, `${doc.name} (${locale}): "${span}" is not app → group → entry`).toHaveLength(3); + const group = navIdOf(bundle, 'group_', parts[1]!); + const entry = navIdOf(bundle, 'nav_', parts[2]!); + expect(group, `${doc.name} (${locale}): Setup has no group labelled "${parts[1]}"`).toBeDefined(); + expect(entry, `${doc.name} (${locale}): Setup has no entry labelled "${parts[2]}"`).toBeDefined(); + return [group!, entry!]; + }); +} + +/** The group each entry this package's own contributions declare sits in. */ +const DECLARED_GROUP = new Map( + SETUP_NAV_CONTRIBUTIONS.flatMap((c) => (c.items ?? []).map((item): [string, string] => [String(item.id), c.group ?? ''])), +); + +describe('the Setup manual names the menu by the labels Setup shows', () => { + it('every menu path of every page is a group and an entry of the Setup app, in English and in Chinese', async () => { + const m = await registeredManifest(); + let named = 0; + for (const doc of m.docs) { + const enPaths = menuPaths(doc, 'en'); + const zhPaths = menuPaths(doc, 'zh'); + // The Chinese page sends the reader to the same screens, in the same order. + expect(zhPaths, `${doc.name}: the zh page names other menu paths than the English one`).toEqual(enPaths); + for (const [group, entry] of enPaths) { + // An entry another package contributes is held to its label alone. + const declared = DECLARED_GROUP.get(entry); + if (declared !== undefined) expect(declared, `${doc.name}: ${entry} is not under ${group}`).toBe(group); + } + named += enPaths.length; + } + expect(named, 'a manual naming no menu path pins nothing').toBeGreaterThan(0); + }); + + it('the three administrator pages each name at least one menu path', () => { + for (const doc of [SETUP_GO_LIVE_DOC, SETUP_ACCESS_DOC, SETUP_INSTALL_UPGRADE_DOC] as RegisteredDoc[]) { + expect(menuPaths(doc, 'en').length, `${doc.name} names no menu path`).toBeGreaterThan(0); + } + }); + + it('a link from one page to another names a page this package registers', async () => { + const m = await registeredManifest(); + const names = new Set(m.docs.map((d) => d.name)); + let links = 0; + for (const doc of m.docs) { + for (const locale of ['en', 'zh'] as const) { + // The console's rule (`doc-links.ts`): `./.md` opens the doc ``. + for (const [, target] of body(doc, locale).matchAll(/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(?:#[^)\s]*)?\)/g)) { + expect(names.has(target!), `${doc.name} (${locale}) links to ${target}, which is not registered`).toBe(true); + links += 1; + } + } + } + expect(links, 'the overview links to the three pages').toBeGreaterThan(0); + }); +}); + +describe('the going-live page names actions and lists by the labels their screens show', () => { + const ACTIONS: Array<[object: string, action: string]> = [ + ['sys_user', 'create_user'], + ['sys_user', 'ban_user'], + ['sys_user', 'unban_user'], + ['sys_invitation', 'invite_user'], + ['sys_invitation', 'resend_invitation'], + ['sys_invitation', 'copy_invitation_link'], + ]; + + it.each(['en', 'zh'] as const)('%s: each action, the Pending list and the Role field carry the bundle label', (locale) => { + const objects = BUNDLES[locale].objects; + const spans = new Set(boldSpans(body(SETUP_GO_LIVE_DOC as RegisteredDoc, locale))); + const expected: Array<[what: string, label: string | undefined]> = [ + ...ACTIONS.map(([object, action]): [string, string | undefined] => [ + `${object}.${action}`, + objects[object]?._actions?.[action]?.label, + ]), + ['sys_invitation list view pending', objects.sys_invitation?._views?.pending?.label], + ['sys_invitation.role', objects.sys_invitation?.fields?.role?.label], + ]; + for (const [what, label] of expected) { + expect(label, `${locale}: the bundle carries no label for ${what}`).toBeTruthy(); + expect(spans.has(label!), `${locale}: the page does not name ${what} as "${label}"`).toBe(true); + } + }); +}); + +describe('the Setup manual keeps to the platform vocabulary', () => { + it('no page teaches a role hierarchy, and the overview names positions and business units', async () => { + const m = await registeredManifest(); + for (const doc of m.docs) { + expect(body(doc, 'en')).not.toMatch(/role hierarchy/i); + expect(body(doc, 'zh')).not.toMatch(/角色层级/); + } + const overview = SETUP_OVERVIEW_DOC as RegisteredDoc; + // The one place the word stays is the invitation's membership Role field, on the going-live page. + expect(body(overview, 'en')).not.toMatch(/\broles?\b/i); + expect(body(overview, 'zh')).not.toMatch(/角色/); + expect(body(overview, 'en')).toMatch(/positions/); + expect(body(overview, 'en')).toMatch(/business-unit tree/); + expect(body(overview, 'zh')).toMatch(/岗位/); + expect(body(overview, 'zh')).toMatch(/业务单元/); + }); + + it('every page carries a zh label, description and body', async () => { + const m = await registeredManifest(); + for (const doc of m.docs) { + const zh = doc.translations?.zh; + expect(zh?.label, `${doc.name} has no zh label`).toBeTruthy(); + expect(zh?.description, `${doc.name} has no zh description`).toBeTruthy(); + expect(zh?.content, `${doc.name} has no zh body`).toBeTruthy(); + } + }); +}); diff --git a/packages/apps/setup/src/setup-access.doc.ts b/packages/apps/setup/src/setup-access.doc.ts index cbd6f6a1b42..538f02c19c9 100644 --- a/packages/apps/setup/src/setup-access.doc.ts +++ b/packages/apps/setup/src/setup-access.doc.ts @@ -48,7 +48,7 @@ nothing. on an object come from a permission set. **2. Which records of it do they reach?** That starts from the object's -**Who can see which records** setting in Studio: *Only the owner can see* (the +**Who can see which records** setting in App Studio: *Only the owner can see* (the default), *Everyone can see*, *Everyone can see and edit*, or *Follows its parent record*. From there access is only widened: @@ -70,7 +70,7 @@ hidden field. platform enforces and reports what each step contributed: which permission set granted, through which position, and which sharing rule widened. Give it a record and it says whether that record is visible and which step decided. -It is in Studio, on a permission set's page and on a package's **Who can see +It is in App Studio, on a permission set's page and on a package's **Who can see which records** page; **Setup → Access & Sharing → Positions and Permissions** opens permission sets there. Explaining another user needs the \`manage_users\` capability, or a delegated administration scope that covers that user. diff --git a/packages/apps/setup/src/setup-install-upgrade.doc.ts b/packages/apps/setup/src/setup-install-upgrade.doc.ts index 281e788ee3a..915c0b490c5 100644 --- a/packages/apps/setup/src/setup-install-upgrade.doc.ts +++ b/packages/apps/setup/src/setup-install-upgrade.doc.ts @@ -83,7 +83,7 @@ puts an earlier version of an app back. What you can undo is your own work: - **Restore package original** on an item you customized deletes your customization, and the package's version is served again. -- An item's **History** in Studio can roll that item back to an earlier +- An item's **History** in App Studio can roll that item back to an earlier version of your customization. So read the confirmation list before you accept an update. diff --git a/packages/apps/studio/src/manual-claims-docs.test.ts b/packages/apps/studio/src/manual-claims-docs.test.ts index 51ddcbbcfa2..b14de98c1e9 100644 --- a/packages/apps/studio/src/manual-claims-docs.test.ts +++ b/packages/apps/studio/src/manual-claims-docs.test.ts @@ -16,7 +16,8 @@ import { describe, expect, it } from 'vitest'; import { resolveDocAudiences, type AudienceBook, type ResolverDoc } from '@objectstack/spec/system'; -import { createStudioAppPlugin, STUDIO_APP_PACKAGE_ID, STUDIO_MANUAL_BOOK } from './index.js'; +import { en, zhCN } from '@objectstack/platform-objects/apps'; +import { createStudioAppPlugin, STUDIO_APP_PACKAGE_ID, STUDIO_MANUAL_BOOK, STUDIO_OVERVIEW_DOC } from './index.js'; interface Registered { id: string; @@ -56,3 +57,39 @@ describe('studio_manual claims every doc @objectstack/studio registers', () => { expect(audiences.get('unbound_page'), 'the manual claims a doc bound to no package').toEqual(['org']); }); }); + +/** + * The overview used to say an edit is a draft only its author sees until it + * is published. A Save in Studio publishes at once; only the AI assistant's + * drafts wait. The statements themselves are read off the console under `ui/`, + * which this package does not depend on, so what is held here is what this + * package can read: the page is served in both languages, each names the app + * by the label its screens show, and every link stays inside the package (a + * page of another package is read by another audience). + */ +describe('the Studio overview is served in English and Chinese, under the app\'s own name', () => { + const zh = STUDIO_OVERVIEW_DOC.translations?.zh; + const appLabel = (bundle: unknown): string => + (bundle as { apps: { studio: { label: string } } }).apps.studio.label; + + it('carries a zh label, description and body', () => { + expect(zh?.label).toBeTruthy(); + expect(zh?.description).toBeTruthy(); + expect(zh?.content).toBeTruthy(); + }); + + it('each language opens with the Studio app\'s label in that language', () => { + expect(STUDIO_OVERVIEW_DOC.content.startsWith(`# ${appLabel(en)} `)).toBe(true); + expect(zh!.content.startsWith(`# ${appLabel(zhCN)}`)).toBe(true); + }); + + it('links to no page outside this package', async () => { + const m = await registeredManifest(); + const names = new Set(m.docs.map((d) => d.name)); + for (const text of [STUDIO_OVERVIEW_DOC.content, zh!.content]) { + for (const [, target] of text.matchAll(/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(?:#[^)\s]*)?\)/g)) { + expect(names.has(target!), `the overview links to ${target}, which this package does not register`).toBe(true); + } + } + }); +}); diff --git a/packages/apps/studio/src/studio-overview.doc.ts b/packages/apps/studio/src/studio-overview.doc.ts index 88ca39a6dd8..2a05811b932 100644 --- a/packages/apps/studio/src/studio-overview.doc.ts +++ b/packages/apps/studio/src/studio-overview.doc.ts @@ -26,23 +26,23 @@ import type { Doc } from '@objectstack/spec/system'; */ export const STUDIO_OVERVIEW_DOC: Doc = { name: 'studio_overview', - label: 'Studio overview', + label: 'App Studio overview', description: 'Orientation for builders: you edit definitions, a Save is live for everyone at once, and changes to a shipped app are kept beside it.', - content: `# Studio overview + content: `# App Studio overview > **Editions.** The AI assistant is not part of the open edition. Where this > page mentions drafts written by the assistant, it applies to editions that > include one. -Studio is the builder app: the workbench for an app's objects, fields, views, +App Studio is the builder app: the workbench for an app's objects, fields, views, flows, permission sets and the rest. Its screens mostly explain themselves. This page covers the rules they do not show. ## You edit definitions, not a database Every object, field and view is a definition, and the running app is generated -from those definitions. That is why one change in Studio reshapes the screens +from those definitions. That is why one change in App Studio reshapes the screens and the API together. ## A Save is live for everyone at once @@ -78,7 +78,7 @@ in place of the shipped one. Nothing you save here reaches another environment. To move it, use **Export** on the package's **Overview** page and import the file in the other -environment's Studio. +environment's App Studio. `, translations: { zh: { From 1237cce3bdfcc1ace91a072d5192a758222bb430 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 16:04:38 +0000 Subject: [PATCH 3/4] docs(setup,studio): hold the pages at English only until the translation is confirmed The three new Setup pages carry no zh yet, and the two overviews keep the zh text they had, marked as pending. The pins read the English bundle alone until then. Adds the changeset. Claude-Session: https://claude.ai/code/session_016WV4cyCTeavBDbQmtMEQeS Co-authored-by: Claude --- .changeset/setup-manual-wave-one.md | 15 +++++ .../apps/setup/src/manual-claims-docs.test.ts | 46 +++++---------- packages/apps/setup/src/setup-access.doc.ts | 55 ------------------ packages/apps/setup/src/setup-go-live.doc.ts | 57 ------------------ .../setup/src/setup-install-upgrade.doc.ts | 58 ------------------- packages/apps/setup/src/setup-overview.doc.ts | 35 +++++------ .../studio/src/manual-claims-docs.test.ts | 23 +++----- .../apps/studio/src/studio-overview.doc.ts | 51 ++++++++-------- 8 files changed, 77 insertions(+), 263 deletions(-) create mode 100644 .changeset/setup-manual-wave-one.md diff --git a/.changeset/setup-manual-wave-one.md b/.changeset/setup-manual-wave-one.md new file mode 100644 index 00000000000..93d38ce38f2 --- /dev/null +++ b/.changeset/setup-manual-wave-one.md @@ -0,0 +1,15 @@ +--- +'@objectstack/setup': patch +'@objectstack/studio': patch +--- + +Clause-②: no +Metadata-protocol: none + +The in-product help for administrators is corrected and extended. + +- **Setup overview** no longer teaches roles and a role hierarchy. It says what the product does: positions hand out permission sets and are flat, and the one hierarchy is the business-unit tree. +- **App Studio overview** no longer says an edit is a draft only its author sees until it is published. A Save is live for everyone at once; only changes the AI assistant drafts wait, on the package Overview's Pending tab. +- Three pages join the Setup manual, read by whoever may open Setup: **Going live** (`setup_go_live`: the order to set an organization up in, why a new user sees almost nothing, what a pending invitation is, what a ban does), **Who can see and do what** (`setup_access`: how access adds up, object permission against record visibility against field security, and how to find out why a record cannot be seen or edited) and **Installing and upgrading apps** (`setup_install_upgrade`: what an install adds, what an update keeps and asks to confirm, why no earlier version can be put back, what uninstall leaves). Each page marks where editions differ. + +The pages are in English. The Chinese of the three new pages is not shipped yet, and the two overviews keep their earlier Chinese text until it is translated from the corrected English. `@objectstack/setup` now also exports `SETUP_GO_LIVE_DOC`, `SETUP_ACCESS_DOC` and `SETUP_INSTALL_UPGRADE_DOC`. diff --git a/packages/apps/setup/src/manual-claims-docs.test.ts b/packages/apps/setup/src/manual-claims-docs.test.ts index 455326fd252..db582ddce01 100644 --- a/packages/apps/setup/src/manual-claims-docs.test.ts +++ b/packages/apps/setup/src/manual-claims-docs.test.ts @@ -16,7 +16,7 @@ import { describe, expect, it } from 'vitest'; import { resolveDocAudiences, type AudienceBook, type ResolverDoc } from '@objectstack/spec/system'; -import { en, zhCN, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps'; +import { en, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps'; import { createSetupAppPlugin, SETUP_ACCESS_DOC, @@ -78,8 +78,10 @@ describe('setup_manual claims every doc @objectstack/setup registers', () => { * does not show sends an administrator looking for a page that is not there. * Each pin below reads the name from the declaration the screen is drawn from * (the Setup app's navigation labels and the object labels, per language), so - * a renamed entry turns the page that still uses the old name red, and the - * zh page is held to the labels the zh screens show. + * a renamed entry turns the page that still uses the old name red. + * + * English only for now: the zh pages are not translated from the corrected + * English yet. The same pins take the zh bundle when they are. * * What these cannot hold: the rules a page states about `ui/` (the marketplace * and Studio screens) and about the security, sharing and approvals plugins. @@ -98,16 +100,15 @@ interface Bundle { objects: Record; } -const BUNDLES: Record<'en' | 'zh', Bundle> = { +type Locale = 'en'; +const BUNDLES: Record = { en: en as unknown as Bundle, - zh: zhCN as unknown as Bundle, }; -/** A page's body in one language: the base is English, `translations.zh` the Chinese. */ -function body(doc: RegisteredDoc, locale: 'en' | 'zh'): string { - const text = locale === 'en' ? doc.content : doc.translations?.zh?.content; - expect(text, `${doc.name} has no ${locale} body`).toBeTruthy(); - return text!; +/** A page's body in one language: the base is the English. */ +function body(doc: RegisteredDoc, _locale: Locale): string { + expect(doc.content, `${doc.name} has no body`).toBeTruthy(); + return doc.content; } /** Every bold span of a page, with a span wrapped over two lines read as one. */ @@ -124,7 +125,7 @@ function navIdOf(bundle: Bundle, prefix: 'group_' | 'nav_', label: string): stri * The menu paths a page names, as `[group id, entry id]`: every bold span that * opens with the Setup app's own name in that language and an arrow. */ -function menuPaths(doc: RegisteredDoc, locale: 'en' | 'zh'): Array<[string, string]> { +function menuPaths(doc: RegisteredDoc, locale: Locale): Array<[string, string]> { const bundle = BUNDLES[locale]; const app = bundle.apps.setup.label; return boldSpans(body(doc, locale)) @@ -146,14 +147,11 @@ const DECLARED_GROUP = new Map( ); describe('the Setup manual names the menu by the labels Setup shows', () => { - it('every menu path of every page is a group and an entry of the Setup app, in English and in Chinese', async () => { + it('every menu path of every page is a group and an entry of the Setup app', async () => { const m = await registeredManifest(); let named = 0; for (const doc of m.docs) { const enPaths = menuPaths(doc, 'en'); - const zhPaths = menuPaths(doc, 'zh'); - // The Chinese page sends the reader to the same screens, in the same order. - expect(zhPaths, `${doc.name}: the zh page names other menu paths than the English one`).toEqual(enPaths); for (const [group, entry] of enPaths) { // An entry another package contributes is held to its label alone. const declared = DECLARED_GROUP.get(entry); @@ -175,7 +173,7 @@ describe('the Setup manual names the menu by the labels Setup shows', () => { const names = new Set(m.docs.map((d) => d.name)); let links = 0; for (const doc of m.docs) { - for (const locale of ['en', 'zh'] as const) { + for (const locale of ['en'] as const) { // The console's rule (`doc-links.ts`): `./.md` opens the doc ``. for (const [, target] of body(doc, locale).matchAll(/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(?:#[^)\s]*)?\)/g)) { expect(names.has(target!), `${doc.name} (${locale}) links to ${target}, which is not registered`).toBe(true); @@ -197,7 +195,7 @@ describe('the going-live page names actions and lists by the labels their screen ['sys_invitation', 'copy_invitation_link'], ]; - it.each(['en', 'zh'] as const)('%s: each action, the Pending list and the Role field carry the bundle label', (locale) => { + it.each(['en'] as const)('%s: each action, the Pending list and the Role field carry the bundle label', (locale) => { const objects = BUNDLES[locale].objects; const spans = new Set(boldSpans(body(SETUP_GO_LIVE_DOC as RegisteredDoc, locale))); const expected: Array<[what: string, label: string | undefined]> = [ @@ -220,25 +218,11 @@ describe('the Setup manual keeps to the platform vocabulary', () => { const m = await registeredManifest(); for (const doc of m.docs) { expect(body(doc, 'en')).not.toMatch(/role hierarchy/i); - expect(body(doc, 'zh')).not.toMatch(/角色层级/); } const overview = SETUP_OVERVIEW_DOC as RegisteredDoc; // The one place the word stays is the invitation's membership Role field, on the going-live page. expect(body(overview, 'en')).not.toMatch(/\broles?\b/i); - expect(body(overview, 'zh')).not.toMatch(/角色/); expect(body(overview, 'en')).toMatch(/positions/); expect(body(overview, 'en')).toMatch(/business-unit tree/); - expect(body(overview, 'zh')).toMatch(/岗位/); - expect(body(overview, 'zh')).toMatch(/业务单元/); - }); - - it('every page carries a zh label, description and body', async () => { - const m = await registeredManifest(); - for (const doc of m.docs) { - const zh = doc.translations?.zh; - expect(zh?.label, `${doc.name} has no zh label`).toBeTruthy(); - expect(zh?.description, `${doc.name} has no zh description`).toBeTruthy(); - expect(zh?.content, `${doc.name} has no zh body`).toBeTruthy(); - } }); }); diff --git a/packages/apps/setup/src/setup-access.doc.ts b/packages/apps/setup/src/setup-access.doc.ts index 538f02c19c9..22e8d79875c 100644 --- a/packages/apps/setup/src/setup-access.doc.ts +++ b/packages/apps/setup/src/setup-access.doc.ts @@ -88,59 +88,4 @@ Then check the cases a permission cannot fix: - **Access disappeared after a move.** Access shared with a business unit follows membership: a person who leaves the unit loses it. `, - translations: { - zh: { - label: '谁能看到什么、做什么', - description: - '访问权限如何叠加,对象权限与记录可见性有何区别,以及如何查明某人为什么看不到或改不了某条记录。', - content: `# 谁能看到什么、做什么 - -> **版本说明。** 让权限集按业务单元读取记录(读取范围「unit」及其他层级范围)需要企业版。 -> 在开源版中,业务单元仍然决定共享规则能覆盖到谁。 -> 本页其余内容在所有版本中都一样。 - -## 访问权限是叠加的 - -一个人的访问权限是三个来源的并集: - -- 他所担任的每个**岗位**所发放的权限集 - (**系统设置 → 权限与共享 → 岗位成员**); -- 直接授予他的权限集 - (**系统设置 → 权限与共享 → 权限集授权**); -- 每位已登录成员都有的基线权限集。 - -没有任何权限集会收回访问权限。要限制某人,就不要授予。 -岗位本身没有任何访问权限:它只是列出其成员会获得的权限集。 -已停用的岗位或权限集不授予任何权限。 - -## 三个相互独立的问题 - -**1. 这个人能不能使用这个对象?** 对象的创建、读取、编辑和删除权限来自权限集。 - -**2. 他能触及该对象的哪些记录?** 这从应用搭建中该对象的**谁能看到哪些记录**设置开始:*只有负责人能看*(默认)、*所有人能看*、*所有人都能看和改*,或*跟随所属的主记录*。 -在此基础上,访问范围只会被放宽: - -- **共享规则**和**共享明细**(**系统设置 → 权限与共享 → 共享规则**和**共享明细**)让更多人获得*读取*权限,或*读取和编辑*权限。它们从不授予删除或更改负责人的权限。 -- 权限集上的**查看所有记录**和**修改所有记录**会跳过该对象的所有权检查和共享检查。 - -**3. 他能读取和编辑哪些字段?** 被字段安全隐藏的字段,会从提供给该用户的内容中移除,所以看起来是不存在,而不是被锁定。字段规则会在一个人的多个权限集之间叠加,取最宽松的一条。 -**查看所有记录**和**修改所有记录**能触及每一条记录,但不会打开被隐藏的字段。 - -## 「我看不到」或「我改不了」 - -**先问平台。** **解释访问权限**会运行与平台实际执行完全相同的评估,并报告每一步的贡献:哪个权限集授予了权限,通过哪个岗位,哪条共享规则放宽了范围。 -给它一条记录,它会告诉你这条记录是否可见,以及由哪一步决定。 -它位于应用搭建中,在权限集的页面上,也在软件包的**谁能看到哪些记录**页面上;**系统设置 → 权限与共享 → 岗位与权限**会在那里打开权限集。 -解释其他用户需要 \`manage_users\` 能力,或覆盖该用户的委托管理范围。 - -然后检查权限无法解决的情况: - -- **审批正在进行。** 审批可以锁定它正在裁决的记录。在此期间,该记录及其下的明细行都拒绝编辑,直到审批完成。 -- **记录已关闭。** 处于其对象的某个关闭状态的记录是最终状态。它和它的明细行不能被编辑或删除,任何权限都无法打开它。 -- **字段缺失。** 字段安全把它隐藏了(见上面的问题 3)。 -- **新用户几乎什么都看不到。** 他们还没有担任任何岗位。 -- **调动后访问权限消失。** 共享给业务单元的访问权限跟随成员关系:离开该单元的人会失去它。 -`, - }, - }, }; diff --git a/packages/apps/setup/src/setup-go-live.doc.ts b/packages/apps/setup/src/setup-go-live.doc.ts index 53d9338911c..d5c82dad213 100644 --- a/packages/apps/setup/src/setup-go-live.doc.ts +++ b/packages/apps/setup/src/setup-go-live.doc.ts @@ -102,61 +102,4 @@ That is the baseline working, not a fault. - Only platform administrators are offered **Ban User**. An organization administrator does not see it. `, - translations: { - zh: { - label: '上线:第一周的设置', - description: - '新组织的设置顺序,新用户为什么几乎什么都看不到,待处理邀请是什么,以及封禁能做什么、不能做什么。', - content: `# 上线:第一周的设置 - -> **版本说明。** 各步骤在所有版本中都一样,只有两处差异。 -> 在由 ObjectOS Cloud 托管的环境中,人员来自托管组织的身份提供方,因此不提供**邀请用户**和**创建用户**。 -> 让权限集读取某个业务单元的全部记录需要企业版;在开源版中,业务单元仍然驱动共享规则。 - -## 按此顺序设置 - -每一步都会被后面的步骤用到。 - -1. **公司与区域。** 填写**系统设置 → 用户与组织 → 公司信息**,然后填写**系统设置 → 公司设置 → 语言与区域**。 - 那里的默认时区决定公式中「今天」的含义、报表如何按日期分组,以及日期和时间如何显示,所以请在大家录入数据之前设置好。 -2. **业务单元。** 在**系统设置 → 用户与组织 → 业务单元**中建立树状结构。 - 共享规则可以把记录共享给某个单元,或某个单元及其下级单元:其成员获得这些访问权限,离开该单元时即失去。 - 仍有下级单元的单元不能删除。 -3. **应用与岗位。** 在邀请任何人之前,先安装你要用的应用:应用会带来它自己的岗位和权限集 - ([安装与升级应用](./setup_install_upgrade.md))。 - 每个岗位和权限集授予了什么,列在**系统设置 → 权限与共享 → 岗位与权限**中。 -4. **人员。** 在**系统设置 → 用户与组织 → 邀请**中发出邀请,然后在**系统设置 → 权限与共享 → 岗位成员**中为每个人指定岗位。 - 第一次发出邀请前,请检查**系统设置 → 消息通知 → 邮件通道**:在不投递邮件的服务器上,不会发出任何邮件,只有通过社交或 SSO 登录且地址已被验证的受邀人才能接受邀请。 - 对其他人,由平台管理员用**创建用户**创建账号。 -5. **登录规则。** **系统设置 → 登录与安全 → 登录方式**适用于整个部署,并且只向平台管理员显示。 - 以上步骤都不必等它:默认情况下,人们用邮箱和密码登录,没有邀请任何人都不能注册。 - 同一分组中的**访问策略**属于某一个组织,并且只能在部署级策略之上增加限制,绝不会放宽。 - -## 新用户几乎什么都看不到 - -这是基线在正常工作,不是故障。 - -- 刚加入的人只拥有每位成员都有的权限集。要获得某个应用中记录的访问权限,需要你给他指定岗位。 -- 你在邀请中选择的**角色**是组织成员级别(所有者、管理员、成员等),不是岗位。 - 成员凭其权限集给予的访问权限在应用中工作;管理员还可以管理成员、邀请、团队和组织设置。 -- 已停用的岗位或权限集不会给担任该岗位或持有该权限集的人授予任何权限。 - -## 尚未被接受的邀请 - -- 这个人还不是成员。他在接受邀请时,以你选择的角色加入。 -- 邀请会一直留在**待处理**下,直到被接受、拒绝或取消,或者过期。 -- **重新发送邀请**会让有效期重新开始计算。已经过期的邀请会被一份新邀请取代。 -- 对尚未过期的待处理邀请,会提供**复制邀请链接**。任何打开该链接的人都可以接受邀请,所以只把它分享给你邀请的人。 - 邀请被接受、拒绝、取消或过期后,链接就会失效。 - -## 有人离开时:封禁,不要删除 - -- **封禁用户**会让此人登出并禁止登录。封禁期间,其 API 密钥、OAuth 访问令牌和令牌续期都会被拒绝。 -- 封禁不会转移任何记录。此人拥有的一切仍归其所有,直到你更改负责人。 -- 一旦被封禁,此人就不能被设为记录的负责人或经办人。已经指定了他的记录仍然可以编辑。 -- **解除封禁**会恢复登录和 API 密钥。封禁同时停用的三样东西不会恢复:此人所负责的 AI 服务账号、他注册的 OAuth 应用,以及他创建的 SCIM 凭据。 -- 只有平台管理员才能使用**封禁用户**。组织管理员看不到它。 -`, - }, - }, }; diff --git a/packages/apps/setup/src/setup-install-upgrade.doc.ts b/packages/apps/setup/src/setup-install-upgrade.doc.ts index 915c0b490c5..45a7111873b 100644 --- a/packages/apps/setup/src/setup-install-upgrade.doc.ts +++ b/packages/apps/setup/src/setup-install-upgrade.doc.ts @@ -99,62 +99,4 @@ So read the confirmation list before you accept an update. - **Delete package** asks what happens to the records: keep them, or delete the tables with every record in them. It cannot be undone. `, - translations: { - zh: { - label: '安装与升级应用', - description: - '安装会增加什么,更新会保留什么、改变什么,为什么无法回到更早的版本,以及卸载会留下什么。', - content: `# 安装与升级应用 - -> **版本说明。** 应用目录由云端控制面提供。 -> **开源版:** 运行时浏览公共目录,除非其运维人员把 \`OS_CLOUD_URL\` 指向别处。 -> **企业版,自托管:** 部署模板以 \`OS_CLOUD_URL=off\` 启动。此时系统设置中没有**浏览应用市场**入口,应用市场页面显示**应用市场已关闭**;运维人员把 \`OS_CLOUD_URL\` 指向某个控制面并重启,即可将其开启。 -> **ObjectOS Cloud:** 由控制面执行安装和更新,托管环境上不能安装代码插件。 - -## 安装 - -在**系统设置 → 应用与 AI → 浏览应用市场**中查找应用。 -已安装的内容列在**系统设置 → 应用与 AI → 已安装应用**中。 -只有组织所有者和管理员可以安装。 - -- **应用要求的可以不止对象。** 有些应用建议把它们的某个权限集授予所有已登录用户(全体成员岗位,即 Everyone)。 - 在你接受之前不会授予任何权限,之后你也可以撤销。 -- **示例记录是真实的记录。** 加载它们是为了让你看到应用在运行。开始正式使用应用时请清除它们。 - 清除只会删除示例记录,绝不会删除人们添加的记录。 - 再次安装不会把已清除的示例记录带回来;**重新加载示例数据**才会。 -- **安装方式,在应用提供选择的情况下。** *托管*让软件包保持权威:它接收升级,其中的条目不在此处编辑。 - *非托管副本*把它一次性复制为你自己的元数据:每个条目都可编辑,副本不再接收升级。 -- **应用可以改动已经存在的对象。** 安装对话框会列出它们。 - 平台对象由所有应用共用,因此对其中一个的改动可能影响登录、用户资料和其他应用。 - -## 升级 - -当目录中列出更高的版本时,已安装的应用会显示**有可用更新**。 - -- **你的定制会被保留。** 更新只替换软件包自己的元数据。你对应用所做的改动保存在它的定制包中,保持原样。 -- **对存有数据的字段的改动必须确认。** 更新对话框会逐条列出,并在能统计时给出持有值的记录数: - - *删除了一个字段并新增了另一个,且没有声明重命名。* 新字段从空开始,原有的值留在一个没有任何东西读取的列中。 - - *字段更改了类型。* 原有的值按存储时的样子保留,不会被转换。 - - *字段更改为不存储列的类型。* 原有的值不再被读取。 -- **对访问权限的改动也必须确认**,当更新改变了在此环境中所做的访问选择所覆盖的范围时。 -- **主版本**(第一位数字变化)可能包含破坏性变更;对话框会说明这一点,并链接到发布说明。 - -## 无法回到更早的版本 - -更新只会提供给更高的版本,产品中没有任何功能能把应用恢复到更早的版本。你能撤销的是你自己的工作: - -- 对你定制过的条目使用**恢复软件包原版**,会删除你的定制,重新提供软件包的版本。 -- 在应用搭建中,条目的**历史**可以把该条目回滚到你定制的更早版本。 - -所以,在接受更新之前,请先阅读确认清单。 - -## 移除应用 - -- **卸载**会立即让应用停止服务,连同它的权限集以及这些权限集的授权。存放在其对象中的记录仍保留在数据库里。 -- 在已安装应用中**禁用**,会让软件包对所有用户停止服务,直到重新启用。不会删除任何记录。 - 如果某条处于启用状态的验证规则读取了该软件包新增的字段,禁用会被拒绝。 -- **删除软件包**会询问如何处理记录:保留它们,或者删除这些表及其中的所有记录。此操作无法撤销。 -`, - }, - }, }; diff --git a/packages/apps/setup/src/setup-overview.doc.ts b/packages/apps/setup/src/setup-overview.doc.ts index 5ab5747962a..e41a338579c 100644 --- a/packages/apps/setup/src/setup-overview.doc.ts +++ b/packages/apps/setup/src/setup-overview.doc.ts @@ -59,30 +59,27 @@ More in this manual: - [Who can see and do what](./setup_access.md) - [Installing and upgrading apps](./setup_install_upgrade.md) `, + // zh below is still the text from before this page was corrected: the + // translation of the corrected English is pending. translations: { zh: { - label: '系统设置概览', - description: - '系统设置背后、界面上看不到的规则:身份与访问、叠加的权限、扁平的岗位,以及记录可见性。', - content: `# 系统设置概览 + label: 'Setup 概览', + description: 'Setup 背后看不见的几条规则:身份≠权限、权限叠加、记录可见性。', + content: `# Setup 概览 -系统设置是管理员应用。它的界面大多一目了然。 -下面是界面背后、界面上看不到的规则。 +Setup 是管理员应用。它的界面大多一目了然——下面这几条是界面背后、UI 没有明说的 +规则。其余内容见 。 -- **用户是身份,不是访问权限。** 用户记录让某人能够登录。他能做什么,取决于他所担任的岗位,以及这些岗位发放的权限集。 - 封禁用户会禁止登录,但不会转移他的任何记录,所以所有权和历史都得以保留。 -- **访问权限是叠加的。** 用户的访问权限是他能触及的所有权限集的并集:通过岗位、通过直接授权,以及通过每位成员都有的基线。 - 你只负责授予访问权限,没有任何东西会减去它。 -- **岗位是扁平的,层级是业务单元树。** 岗位是发放权限集的职能。它没有上级,也没有汇报关系。 - 公司结构位于**系统设置 → 用户与组织 → 业务单元**。 -- **「看不到记录」通常是哪些记录的问题,而不是哪些对象的问题。** - 对象权限决定用户处理哪些种类的记录。他能触及该种类的哪些记录,从该对象的**谁能看到哪些记录**设置开始,并由共享规则和共享明细放宽。 +- **用户是身份,不是权限。** 创建一条 \`sys_user\` 只是让人能登录;他*能做什么* + 完全由你随后分配的角色和权限集决定。停用用户会收回登录权,但不删除其记录, + 归属与历史因此得以保留。 +- **权限是叠加的。** 用户的最终权限是其所有权限集的*并集*——你是在授予能力, + 从不做减法。 +- **"看不到某条记录"几乎总是共享问题,不是权限问题。** 对象级权限决定用户能碰 + *哪类*记录;共享决定*哪些行*。可见性从组织级默认出发,只会被角色层级和共享规则 + *放宽*,绝不会被悄悄收窄。 -本手册中的更多内容: - -- [上线:第一周的设置](./setup_go_live.md) -- [谁能看到什么、做什么](./setup_access.md) -- [安装与升级应用](./setup_install_upgrade.md) +完整安全模型见 。 `, }, }, diff --git a/packages/apps/studio/src/manual-claims-docs.test.ts b/packages/apps/studio/src/manual-claims-docs.test.ts index b14de98c1e9..2bca68eb413 100644 --- a/packages/apps/studio/src/manual-claims-docs.test.ts +++ b/packages/apps/studio/src/manual-claims-docs.test.ts @@ -16,7 +16,7 @@ import { describe, expect, it } from 'vitest'; import { resolveDocAudiences, type AudienceBook, type ResolverDoc } from '@objectstack/spec/system'; -import { en, zhCN } from '@objectstack/platform-objects/apps'; +import { en } from '@objectstack/platform-objects/apps'; import { createStudioAppPlugin, STUDIO_APP_PACKAGE_ID, STUDIO_MANUAL_BOOK, STUDIO_OVERVIEW_DOC } from './index.js'; interface Registered { @@ -63,30 +63,23 @@ describe('studio_manual claims every doc @objectstack/studio registers', () => { * is published. A Save in Studio publishes at once; only the AI assistant's * drafts wait. The statements themselves are read off the console under `ui/`, * which this package does not depend on, so what is held here is what this - * package can read: the page is served in both languages, each names the app - * by the label its screens show, and every link stays inside the package (a - * page of another package is read by another audience). + * package can read: the page names the app by the label its screens show, and + * every link stays inside the package (a page of another package is read by + * another audience). English only for now: the zh page is not translated from + * the corrected English yet. */ -describe('the Studio overview is served in English and Chinese, under the app\'s own name', () => { - const zh = STUDIO_OVERVIEW_DOC.translations?.zh; +describe('the Studio overview names the app as its screens do', () => { const appLabel = (bundle: unknown): string => (bundle as { apps: { studio: { label: string } } }).apps.studio.label; - it('carries a zh label, description and body', () => { - expect(zh?.label).toBeTruthy(); - expect(zh?.description).toBeTruthy(); - expect(zh?.content).toBeTruthy(); - }); - - it('each language opens with the Studio app\'s label in that language', () => { + it('opens with the Studio app\'s own label', () => { expect(STUDIO_OVERVIEW_DOC.content.startsWith(`# ${appLabel(en)} `)).toBe(true); - expect(zh!.content.startsWith(`# ${appLabel(zhCN)}`)).toBe(true); }); it('links to no page outside this package', async () => { const m = await registeredManifest(); const names = new Set(m.docs.map((d) => d.name)); - for (const text of [STUDIO_OVERVIEW_DOC.content, zh!.content]) { + for (const text of [STUDIO_OVERVIEW_DOC.content]) { for (const [, target] of text.matchAll(/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(?:#[^)\s]*)?\)/g)) { expect(names.has(target!), `the overview links to ${target}, which this package does not register`).toBe(true); } diff --git a/packages/apps/studio/src/studio-overview.doc.ts b/packages/apps/studio/src/studio-overview.doc.ts index 2a05811b932..5d791c9d5ed 100644 --- a/packages/apps/studio/src/studio-overview.doc.ts +++ b/packages/apps/studio/src/studio-overview.doc.ts @@ -80,44 +80,39 @@ Nothing you save here reaches another environment. To move it, use **Export** on the package's **Overview** page and import the file in the other environment's App Studio. `, + // zh below is still the text from before this page was corrected: the + // translation of the corrected English is pending. translations: { zh: { - label: '应用搭建概览', - description: - '面向搭建者的导览:你编辑的是定义,保存会立即对所有人生效,对应用自带内容的改动保存在它旁边。', - content: `# 应用搭建概览 + label: 'Studio 概览', + description: '搭建者入门:元数据优先模型、覆盖层优先级、发布与部署。', + content: `# Studio 概览 -> **版本说明。** 开源版不包含 AI 助手。本页提到由助手撰写的草稿之处,适用于包含助手的版本。 +Studio 是搭建者应用——塑造平台*元数据*的工作台:对象、字段、视图、流程、智能体等。 +它的大多数界面一目了然;本页讲的是那条界面上看不见、却支配你在这里一切操作的规则。 +完整参考见 。 -应用搭建是搭建者应用:用于处理应用的对象、字段、视图、流程、权限集等的工作台。它的界面大多一目了然。 -本页介绍界面上看不到的规则。 +## 元数据优先 -## 你编辑的是定义,不是数据库 +在 Studio 里你编辑的不是运行中的数据库,而是*定义*。每个对象、字段、视图都是一条 +元数据记录,运行的应用由这些元数据生成。这就是为什么 Studio 里的一处改动能同时重塑 +UI 和 API:你改的是模型,而不是修补某个界面。 -每个对象、字段和视图都是一份定义,运行中的应用由这些定义生成。 -所以在应用搭建中的一处改动,会同时改变界面和 API。 +## 编辑即覆盖层(看不见的规则) -## 保存会立即对所有人生效 +你的改动不会原地修改某个包发布的元数据。Studio 在基础定义之上写一层**覆盖层**, +运行时按优先级解析两者:未发布的**草稿**在你编辑时对你生效,已发布的**租户覆盖层** +优先于包的基线,包基线则是兜底(ADR-0005、ADR-0033)。实际后果:基础定义永不被 +销毁,所以覆盖层总能回退以恢复原样——而一个"改不动"的字段,通常是被更高优先级的 +层遮住了。 -没有私有草稿,你自己的编辑也没有审核步骤。 +## 发布与部署 -- **保存即发布。** 保存一完成,改动就对所有用户生效。 -- **有风险的保存会先询问。** 如果某次保存会删除已发布的字段或更改其类型,在写入任何内容之前,会逐条指出每项改动及其对现有记录的影响。 -- **两个人编辑同一个条目。** 如果在你打开该条目之后,别人发布了它,你的保存不会覆盖他们的:系统会询问你是重新加载还是覆盖。 -- **AI 助手的改动需要等待。** 助手起草的改动不会自行生效。它们会在软件包的**概览**页面的**待发布**标签页上等待,直到你审阅并发布。 -- **还原到上次发布不是撤销。** 它会丢弃从未发布的改动,不会撤回已经发布的内容。 +草稿只对你自己可见,直到你**发布**它,把覆盖层提升给整个租户看到。在环境之间搬运 +改动(例如开发 → 生产)是单独的**部署**步骤,不是发布的自动副作用——把两者分开, +才能让你在一个环境里安全搭建、再上线。 -## 应用自带的内容是只读的;你的改动保存在它旁边 - -应用自带的软件包不能被直接修改。当你改动其中的内容时,你的版本会保存在该应用自己的定制包中,并取代自带的版本提供服务。 - -- 自带的版本从不被改动,因此应用的更新会保留你的改动 - (见系统设置手册中的《安装与升级应用》)。 -- **恢复软件包原版**会删除你对某个条目的定制,重新提供软件包的版本。 - -## 把工作迁移到另一个环境 - -你在这里保存的内容不会到达其他环境。要迁移它,请使用软件包**概览**页面上的**导出**,并在另一个环境的应用搭建中导入该文件。 +草稿、覆盖层与部署的细节见 。 `, }, }, From 4e3cd7b5f337436ed6e59a76d85432123a4fbee4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 23:23:28 +0000 Subject: [PATCH 4/4] docs(setup,studio): add the Chinese of the five manual pages The maintainer confirmed the English. Each page now carries translations.zh, translated from that English with the product's own zh labels as glossary, and the claim tests pin both languages again. Claude-Session: https://claude.ai/code/session_016WV4cyCTeavBDbQmtMEQeS Co-authored-by: Claude --- .changeset/setup-manual-wave-one.md | 2 +- .../apps/setup/src/manual-claims-docs.test.ts | 46 ++++++++++----- packages/apps/setup/src/setup-access.doc.ts | 55 ++++++++++++++++++ packages/apps/setup/src/setup-go-live.doc.ts | 57 ++++++++++++++++++ .../setup/src/setup-install-upgrade.doc.ts | 58 +++++++++++++++++++ packages/apps/setup/src/setup-overview.doc.ts | 35 ++++++----- .../studio/src/manual-claims-docs.test.ts | 23 +++++--- .../apps/studio/src/studio-overview.doc.ts | 51 ++++++++-------- 8 files changed, 264 insertions(+), 63 deletions(-) diff --git a/.changeset/setup-manual-wave-one.md b/.changeset/setup-manual-wave-one.md index 93d38ce38f2..422d7965644 100644 --- a/.changeset/setup-manual-wave-one.md +++ b/.changeset/setup-manual-wave-one.md @@ -12,4 +12,4 @@ The in-product help for administrators is corrected and extended. - **App Studio overview** no longer says an edit is a draft only its author sees until it is published. A Save is live for everyone at once; only changes the AI assistant drafts wait, on the package Overview's Pending tab. - Three pages join the Setup manual, read by whoever may open Setup: **Going live** (`setup_go_live`: the order to set an organization up in, why a new user sees almost nothing, what a pending invitation is, what a ban does), **Who can see and do what** (`setup_access`: how access adds up, object permission against record visibility against field security, and how to find out why a record cannot be seen or edited) and **Installing and upgrading apps** (`setup_install_upgrade`: what an install adds, what an update keeps and asks to confirm, why no earlier version can be put back, what uninstall leaves). Each page marks where editions differ. -The pages are in English. The Chinese of the three new pages is not shipped yet, and the two overviews keep their earlier Chinese text until it is translated from the corrected English. `@objectstack/setup` now also exports `SETUP_GO_LIVE_DOC`, `SETUP_ACCESS_DOC` and `SETUP_INSTALL_UPGRADE_DOC`. +Every page is served in English and Chinese. `@objectstack/setup` now also exports `SETUP_GO_LIVE_DOC`, `SETUP_ACCESS_DOC` and `SETUP_INSTALL_UPGRADE_DOC`. diff --git a/packages/apps/setup/src/manual-claims-docs.test.ts b/packages/apps/setup/src/manual-claims-docs.test.ts index db582ddce01..455326fd252 100644 --- a/packages/apps/setup/src/manual-claims-docs.test.ts +++ b/packages/apps/setup/src/manual-claims-docs.test.ts @@ -16,7 +16,7 @@ import { describe, expect, it } from 'vitest'; import { resolveDocAudiences, type AudienceBook, type ResolverDoc } from '@objectstack/spec/system'; -import { en, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps'; +import { en, zhCN, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps'; import { createSetupAppPlugin, SETUP_ACCESS_DOC, @@ -78,10 +78,8 @@ describe('setup_manual claims every doc @objectstack/setup registers', () => { * does not show sends an administrator looking for a page that is not there. * Each pin below reads the name from the declaration the screen is drawn from * (the Setup app's navigation labels and the object labels, per language), so - * a renamed entry turns the page that still uses the old name red. - * - * English only for now: the zh pages are not translated from the corrected - * English yet. The same pins take the zh bundle when they are. + * a renamed entry turns the page that still uses the old name red, and the + * zh page is held to the labels the zh screens show. * * What these cannot hold: the rules a page states about `ui/` (the marketplace * and Studio screens) and about the security, sharing and approvals plugins. @@ -100,15 +98,16 @@ interface Bundle { objects: Record; } -type Locale = 'en'; -const BUNDLES: Record = { +const BUNDLES: Record<'en' | 'zh', Bundle> = { en: en as unknown as Bundle, + zh: zhCN as unknown as Bundle, }; -/** A page's body in one language: the base is the English. */ -function body(doc: RegisteredDoc, _locale: Locale): string { - expect(doc.content, `${doc.name} has no body`).toBeTruthy(); - return doc.content; +/** A page's body in one language: the base is English, `translations.zh` the Chinese. */ +function body(doc: RegisteredDoc, locale: 'en' | 'zh'): string { + const text = locale === 'en' ? doc.content : doc.translations?.zh?.content; + expect(text, `${doc.name} has no ${locale} body`).toBeTruthy(); + return text!; } /** Every bold span of a page, with a span wrapped over two lines read as one. */ @@ -125,7 +124,7 @@ function navIdOf(bundle: Bundle, prefix: 'group_' | 'nav_', label: string): stri * The menu paths a page names, as `[group id, entry id]`: every bold span that * opens with the Setup app's own name in that language and an arrow. */ -function menuPaths(doc: RegisteredDoc, locale: Locale): Array<[string, string]> { +function menuPaths(doc: RegisteredDoc, locale: 'en' | 'zh'): Array<[string, string]> { const bundle = BUNDLES[locale]; const app = bundle.apps.setup.label; return boldSpans(body(doc, locale)) @@ -147,11 +146,14 @@ const DECLARED_GROUP = new Map( ); describe('the Setup manual names the menu by the labels Setup shows', () => { - it('every menu path of every page is a group and an entry of the Setup app', async () => { + it('every menu path of every page is a group and an entry of the Setup app, in English and in Chinese', async () => { const m = await registeredManifest(); let named = 0; for (const doc of m.docs) { const enPaths = menuPaths(doc, 'en'); + const zhPaths = menuPaths(doc, 'zh'); + // The Chinese page sends the reader to the same screens, in the same order. + expect(zhPaths, `${doc.name}: the zh page names other menu paths than the English one`).toEqual(enPaths); for (const [group, entry] of enPaths) { // An entry another package contributes is held to its label alone. const declared = DECLARED_GROUP.get(entry); @@ -173,7 +175,7 @@ describe('the Setup manual names the menu by the labels Setup shows', () => { const names = new Set(m.docs.map((d) => d.name)); let links = 0; for (const doc of m.docs) { - for (const locale of ['en'] as const) { + for (const locale of ['en', 'zh'] as const) { // The console's rule (`doc-links.ts`): `./.md` opens the doc ``. for (const [, target] of body(doc, locale).matchAll(/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(?:#[^)\s]*)?\)/g)) { expect(names.has(target!), `${doc.name} (${locale}) links to ${target}, which is not registered`).toBe(true); @@ -195,7 +197,7 @@ describe('the going-live page names actions and lists by the labels their screen ['sys_invitation', 'copy_invitation_link'], ]; - it.each(['en'] as const)('%s: each action, the Pending list and the Role field carry the bundle label', (locale) => { + it.each(['en', 'zh'] as const)('%s: each action, the Pending list and the Role field carry the bundle label', (locale) => { const objects = BUNDLES[locale].objects; const spans = new Set(boldSpans(body(SETUP_GO_LIVE_DOC as RegisteredDoc, locale))); const expected: Array<[what: string, label: string | undefined]> = [ @@ -218,11 +220,25 @@ describe('the Setup manual keeps to the platform vocabulary', () => { const m = await registeredManifest(); for (const doc of m.docs) { expect(body(doc, 'en')).not.toMatch(/role hierarchy/i); + expect(body(doc, 'zh')).not.toMatch(/角色层级/); } const overview = SETUP_OVERVIEW_DOC as RegisteredDoc; // The one place the word stays is the invitation's membership Role field, on the going-live page. expect(body(overview, 'en')).not.toMatch(/\broles?\b/i); + expect(body(overview, 'zh')).not.toMatch(/角色/); expect(body(overview, 'en')).toMatch(/positions/); expect(body(overview, 'en')).toMatch(/business-unit tree/); + expect(body(overview, 'zh')).toMatch(/岗位/); + expect(body(overview, 'zh')).toMatch(/业务单元/); + }); + + it('every page carries a zh label, description and body', async () => { + const m = await registeredManifest(); + for (const doc of m.docs) { + const zh = doc.translations?.zh; + expect(zh?.label, `${doc.name} has no zh label`).toBeTruthy(); + expect(zh?.description, `${doc.name} has no zh description`).toBeTruthy(); + expect(zh?.content, `${doc.name} has no zh body`).toBeTruthy(); + } }); }); diff --git a/packages/apps/setup/src/setup-access.doc.ts b/packages/apps/setup/src/setup-access.doc.ts index 22e8d79875c..538f02c19c9 100644 --- a/packages/apps/setup/src/setup-access.doc.ts +++ b/packages/apps/setup/src/setup-access.doc.ts @@ -88,4 +88,59 @@ Then check the cases a permission cannot fix: - **Access disappeared after a move.** Access shared with a business unit follows membership: a person who leaves the unit loses it. `, + translations: { + zh: { + label: '谁能看到什么、做什么', + description: + '访问权限如何叠加,对象权限与记录可见性有何区别,以及如何查明某人为什么看不到或改不了某条记录。', + content: `# 谁能看到什么、做什么 + +> **版本说明。** 让权限集按业务单元读取记录(读取范围「unit」及其他层级范围)需要企业版。 +> 在开源版中,业务单元仍然决定共享规则能覆盖到谁。 +> 本页其余内容在所有版本中都一样。 + +## 访问权限是叠加的 + +一个人的访问权限是三个来源的并集: + +- 他所担任的每个**岗位**所发放的权限集 + (**系统设置 → 权限与共享 → 岗位成员**); +- 直接授予他的权限集 + (**系统设置 → 权限与共享 → 权限集授权**); +- 每位已登录成员都有的基线权限集。 + +没有任何权限集会收回访问权限。要限制某人,就不要授予。 +岗位本身没有任何访问权限:它只是列出其成员会获得的权限集。 +已停用的岗位或权限集不授予任何权限。 + +## 三个相互独立的问题 + +**1. 这个人能不能使用这个对象?** 对象的创建、读取、编辑和删除权限来自权限集。 + +**2. 他能触及该对象的哪些记录?** 这从应用搭建中该对象的**谁能看到哪些记录**设置开始:*只有负责人能看*(默认)、*所有人能看*、*所有人都能看和改*,或*跟随所属的主记录*。 +在此基础上,访问范围只会被放宽: + +- **共享规则**和**共享明细**(**系统设置 → 权限与共享 → 共享规则**和**共享明细**)让更多人获得*读取*权限,或*读取和编辑*权限。它们从不授予删除或更改负责人的权限。 +- 权限集上的**查看所有记录**和**修改所有记录**会跳过该对象的所有权检查和共享检查。 + +**3. 他能读取和编辑哪些字段?** 被字段安全隐藏的字段,会从提供给该用户的内容中移除,所以看起来是不存在,而不是被锁定。字段规则会在一个人的多个权限集之间叠加,取最宽松的一条。 +**查看所有记录**和**修改所有记录**能触及每一条记录,但不会打开被隐藏的字段。 + +## 「我看不到」或「我改不了」 + +**先问平台。** **解释访问权限**会运行与平台实际执行完全相同的评估,并报告每一步的贡献:哪个权限集授予了权限,通过哪个岗位,哪条共享规则放宽了范围。 +给它一条记录,它会告诉你这条记录是否可见,以及由哪一步决定。 +它位于应用搭建中,在权限集的页面上,也在软件包的**谁能看到哪些记录**页面上;**系统设置 → 权限与共享 → 岗位与权限**会在那里打开权限集。 +解释其他用户需要 \`manage_users\` 能力,或覆盖该用户的委托管理范围。 + +然后检查权限无法解决的情况: + +- **审批正在进行。** 审批可以锁定它正在裁决的记录。在此期间,该记录及其下的明细行都拒绝编辑,直到审批完成。 +- **记录已关闭。** 处于其对象的某个关闭状态的记录是最终状态。它和它的明细行不能被编辑或删除,任何权限都无法打开它。 +- **字段缺失。** 字段安全把它隐藏了(见上面的问题 3)。 +- **新用户几乎什么都看不到。** 他们还没有担任任何岗位。 +- **调动后访问权限消失。** 共享给业务单元的访问权限跟随成员关系:离开该单元的人会失去它。 +`, + }, + }, }; diff --git a/packages/apps/setup/src/setup-go-live.doc.ts b/packages/apps/setup/src/setup-go-live.doc.ts index d5c82dad213..53d9338911c 100644 --- a/packages/apps/setup/src/setup-go-live.doc.ts +++ b/packages/apps/setup/src/setup-go-live.doc.ts @@ -102,4 +102,61 @@ That is the baseline working, not a fault. - Only platform administrators are offered **Ban User**. An organization administrator does not see it. `, + translations: { + zh: { + label: '上线:第一周的设置', + description: + '新组织的设置顺序,新用户为什么几乎什么都看不到,待处理邀请是什么,以及封禁能做什么、不能做什么。', + content: `# 上线:第一周的设置 + +> **版本说明。** 各步骤在所有版本中都一样,只有两处差异。 +> 在由 ObjectOS Cloud 托管的环境中,人员来自托管组织的身份提供方,因此不提供**邀请用户**和**创建用户**。 +> 让权限集读取某个业务单元的全部记录需要企业版;在开源版中,业务单元仍然驱动共享规则。 + +## 按此顺序设置 + +每一步都会被后面的步骤用到。 + +1. **公司与区域。** 填写**系统设置 → 用户与组织 → 公司信息**,然后填写**系统设置 → 公司设置 → 语言与区域**。 + 那里的默认时区决定公式中「今天」的含义、报表如何按日期分组,以及日期和时间如何显示,所以请在大家录入数据之前设置好。 +2. **业务单元。** 在**系统设置 → 用户与组织 → 业务单元**中建立树状结构。 + 共享规则可以把记录共享给某个单元,或某个单元及其下级单元:其成员获得这些访问权限,离开该单元时即失去。 + 仍有下级单元的单元不能删除。 +3. **应用与岗位。** 在邀请任何人之前,先安装你要用的应用:应用会带来它自己的岗位和权限集 + ([安装与升级应用](./setup_install_upgrade.md))。 + 每个岗位和权限集授予了什么,列在**系统设置 → 权限与共享 → 岗位与权限**中。 +4. **人员。** 在**系统设置 → 用户与组织 → 邀请**中发出邀请,然后在**系统设置 → 权限与共享 → 岗位成员**中为每个人指定岗位。 + 第一次发出邀请前,请检查**系统设置 → 消息通知 → 邮件通道**:在不投递邮件的服务器上,不会发出任何邮件,只有通过社交或 SSO 登录且地址已被验证的受邀人才能接受邀请。 + 对其他人,由平台管理员用**创建用户**创建账号。 +5. **登录规则。** **系统设置 → 登录与安全 → 登录方式**适用于整个部署,并且只向平台管理员显示。 + 以上步骤都不必等它:默认情况下,人们用邮箱和密码登录,没有邀请任何人都不能注册。 + 同一分组中的**访问策略**属于某一个组织,并且只能在部署级策略之上增加限制,绝不会放宽。 + +## 新用户几乎什么都看不到 + +这是基线在正常工作,不是故障。 + +- 刚加入的人只拥有每位成员都有的权限集。要获得某个应用中记录的访问权限,需要你给他指定岗位。 +- 你在邀请中选择的**角色**是组织成员级别(所有者、管理员、成员等),不是岗位。 + 成员凭其权限集给予的访问权限在应用中工作;管理员还可以管理成员、邀请、团队和组织设置。 +- 已停用的岗位或权限集不会给担任该岗位或持有该权限集的人授予任何权限。 + +## 尚未被接受的邀请 + +- 这个人还不是成员。他在接受邀请时,以你选择的角色加入。 +- 邀请会一直留在**待处理**下,直到被接受、拒绝或取消,或者过期。 +- **重新发送邀请**会让有效期重新开始计算。已经过期的邀请会被一份新邀请取代。 +- 对尚未过期的待处理邀请,会提供**复制邀请链接**。任何打开该链接的人都可以接受邀请,所以只把它分享给你邀请的人。 + 邀请被接受、拒绝、取消或过期后,链接就会失效。 + +## 有人离开时:封禁,不要删除 + +- **封禁用户**会让此人登出并禁止登录。封禁期间,其 API 密钥、OAuth 访问令牌和令牌续期都会被拒绝。 +- 封禁不会转移任何记录。此人拥有的一切仍归其所有,直到你更改负责人。 +- 一旦被封禁,此人就不能被设为记录的负责人或经办人。已经指定了他的记录仍然可以编辑。 +- **解除封禁**会恢复登录和 API 密钥。封禁同时停用的三样东西不会恢复:此人所负责的 AI 服务账号、他注册的 OAuth 应用,以及他创建的 SCIM 凭据。 +- 只有平台管理员才能使用**封禁用户**。组织管理员看不到它。 +`, + }, + }, }; diff --git a/packages/apps/setup/src/setup-install-upgrade.doc.ts b/packages/apps/setup/src/setup-install-upgrade.doc.ts index 45a7111873b..915c0b490c5 100644 --- a/packages/apps/setup/src/setup-install-upgrade.doc.ts +++ b/packages/apps/setup/src/setup-install-upgrade.doc.ts @@ -99,4 +99,62 @@ So read the confirmation list before you accept an update. - **Delete package** asks what happens to the records: keep them, or delete the tables with every record in them. It cannot be undone. `, + translations: { + zh: { + label: '安装与升级应用', + description: + '安装会增加什么,更新会保留什么、改变什么,为什么无法回到更早的版本,以及卸载会留下什么。', + content: `# 安装与升级应用 + +> **版本说明。** 应用目录由云端控制面提供。 +> **开源版:** 运行时浏览公共目录,除非其运维人员把 \`OS_CLOUD_URL\` 指向别处。 +> **企业版,自托管:** 部署模板以 \`OS_CLOUD_URL=off\` 启动。此时系统设置中没有**浏览应用市场**入口,应用市场页面显示**应用市场已关闭**;运维人员把 \`OS_CLOUD_URL\` 指向某个控制面并重启,即可将其开启。 +> **ObjectOS Cloud:** 由控制面执行安装和更新,托管环境上不能安装代码插件。 + +## 安装 + +在**系统设置 → 应用与 AI → 浏览应用市场**中查找应用。 +已安装的内容列在**系统设置 → 应用与 AI → 已安装应用**中。 +只有组织所有者和管理员可以安装。 + +- **应用要求的可以不止对象。** 有些应用建议把它们的某个权限集授予所有已登录用户(全体成员岗位,即 Everyone)。 + 在你接受之前不会授予任何权限,之后你也可以撤销。 +- **示例记录是真实的记录。** 加载它们是为了让你看到应用在运行。开始正式使用应用时请清除它们。 + 清除只会删除示例记录,绝不会删除人们添加的记录。 + 再次安装不会把已清除的示例记录带回来;**重新加载示例数据**才会。 +- **安装方式,在应用提供选择的情况下。** *托管*让软件包保持权威:它接收升级,其中的条目不在此处编辑。 + *非托管副本*把它一次性复制为你自己的元数据:每个条目都可编辑,副本不再接收升级。 +- **应用可以改动已经存在的对象。** 安装对话框会列出它们。 + 平台对象由所有应用共用,因此对其中一个的改动可能影响登录、用户资料和其他应用。 + +## 升级 + +当目录中列出更高的版本时,已安装的应用会显示**有可用更新**。 + +- **你的定制会被保留。** 更新只替换软件包自己的元数据。你对应用所做的改动保存在它的定制包中,保持原样。 +- **对存有数据的字段的改动必须确认。** 更新对话框会逐条列出,并在能统计时给出持有值的记录数: + - *删除了一个字段并新增了另一个,且没有声明重命名。* 新字段从空开始,原有的值留在一个没有任何东西读取的列中。 + - *字段更改了类型。* 原有的值按存储时的样子保留,不会被转换。 + - *字段更改为不存储列的类型。* 原有的值不再被读取。 +- **对访问权限的改动也必须确认**,当更新改变了在此环境中所做的访问选择所覆盖的范围时。 +- **主版本**(第一位数字变化)可能包含破坏性变更;对话框会说明这一点,并链接到发布说明。 + +## 无法回到更早的版本 + +更新只会提供给更高的版本,产品中没有任何功能能把应用恢复到更早的版本。你能撤销的是你自己的工作: + +- 对你定制过的条目使用**恢复软件包原版**,会删除你的定制,重新提供软件包的版本。 +- 在应用搭建中,条目的**历史**可以把该条目回滚到你定制的更早版本。 + +所以,在接受更新之前,请先阅读确认清单。 + +## 移除应用 + +- **卸载**会立即让应用停止服务,连同它的权限集以及这些权限集的授权。存放在其对象中的记录仍保留在数据库里。 +- 在已安装应用中**禁用**,会让软件包对所有用户停止服务,直到重新启用。不会删除任何记录。 + 如果某条处于启用状态的验证规则读取了该软件包新增的字段,禁用会被拒绝。 +- **删除软件包**会询问如何处理记录:保留它们,或者删除这些表及其中的所有记录。此操作无法撤销。 +`, + }, + }, }; diff --git a/packages/apps/setup/src/setup-overview.doc.ts b/packages/apps/setup/src/setup-overview.doc.ts index e41a338579c..5ab5747962a 100644 --- a/packages/apps/setup/src/setup-overview.doc.ts +++ b/packages/apps/setup/src/setup-overview.doc.ts @@ -59,27 +59,30 @@ More in this manual: - [Who can see and do what](./setup_access.md) - [Installing and upgrading apps](./setup_install_upgrade.md) `, - // zh below is still the text from before this page was corrected: the - // translation of the corrected English is pending. translations: { zh: { - label: 'Setup 概览', - description: 'Setup 背后看不见的几条规则:身份≠权限、权限叠加、记录可见性。', - content: `# Setup 概览 + label: '系统设置概览', + description: + '系统设置背后、界面上看不到的规则:身份与访问、叠加的权限、扁平的岗位,以及记录可见性。', + content: `# 系统设置概览 -Setup 是管理员应用。它的界面大多一目了然——下面这几条是界面背后、UI 没有明说的 -规则。其余内容见 。 +系统设置是管理员应用。它的界面大多一目了然。 +下面是界面背后、界面上看不到的规则。 -- **用户是身份,不是权限。** 创建一条 \`sys_user\` 只是让人能登录;他*能做什么* - 完全由你随后分配的角色和权限集决定。停用用户会收回登录权,但不删除其记录, - 归属与历史因此得以保留。 -- **权限是叠加的。** 用户的最终权限是其所有权限集的*并集*——你是在授予能力, - 从不做减法。 -- **"看不到某条记录"几乎总是共享问题,不是权限问题。** 对象级权限决定用户能碰 - *哪类*记录;共享决定*哪些行*。可见性从组织级默认出发,只会被角色层级和共享规则 - *放宽*,绝不会被悄悄收窄。 +- **用户是身份,不是访问权限。** 用户记录让某人能够登录。他能做什么,取决于他所担任的岗位,以及这些岗位发放的权限集。 + 封禁用户会禁止登录,但不会转移他的任何记录,所以所有权和历史都得以保留。 +- **访问权限是叠加的。** 用户的访问权限是他能触及的所有权限集的并集:通过岗位、通过直接授权,以及通过每位成员都有的基线。 + 你只负责授予访问权限,没有任何东西会减去它。 +- **岗位是扁平的,层级是业务单元树。** 岗位是发放权限集的职能。它没有上级,也没有汇报关系。 + 公司结构位于**系统设置 → 用户与组织 → 业务单元**。 +- **「看不到记录」通常是哪些记录的问题,而不是哪些对象的问题。** + 对象权限决定用户处理哪些种类的记录。他能触及该种类的哪些记录,从该对象的**谁能看到哪些记录**设置开始,并由共享规则和共享明细放宽。 -完整安全模型见 。 +本手册中的更多内容: + +- [上线:第一周的设置](./setup_go_live.md) +- [谁能看到什么、做什么](./setup_access.md) +- [安装与升级应用](./setup_install_upgrade.md) `, }, }, diff --git a/packages/apps/studio/src/manual-claims-docs.test.ts b/packages/apps/studio/src/manual-claims-docs.test.ts index 2bca68eb413..b14de98c1e9 100644 --- a/packages/apps/studio/src/manual-claims-docs.test.ts +++ b/packages/apps/studio/src/manual-claims-docs.test.ts @@ -16,7 +16,7 @@ import { describe, expect, it } from 'vitest'; import { resolveDocAudiences, type AudienceBook, type ResolverDoc } from '@objectstack/spec/system'; -import { en } from '@objectstack/platform-objects/apps'; +import { en, zhCN } from '@objectstack/platform-objects/apps'; import { createStudioAppPlugin, STUDIO_APP_PACKAGE_ID, STUDIO_MANUAL_BOOK, STUDIO_OVERVIEW_DOC } from './index.js'; interface Registered { @@ -63,23 +63,30 @@ describe('studio_manual claims every doc @objectstack/studio registers', () => { * is published. A Save in Studio publishes at once; only the AI assistant's * drafts wait. The statements themselves are read off the console under `ui/`, * which this package does not depend on, so what is held here is what this - * package can read: the page names the app by the label its screens show, and - * every link stays inside the package (a page of another package is read by - * another audience). English only for now: the zh page is not translated from - * the corrected English yet. + * package can read: the page is served in both languages, each names the app + * by the label its screens show, and every link stays inside the package (a + * page of another package is read by another audience). */ -describe('the Studio overview names the app as its screens do', () => { +describe('the Studio overview is served in English and Chinese, under the app\'s own name', () => { + const zh = STUDIO_OVERVIEW_DOC.translations?.zh; const appLabel = (bundle: unknown): string => (bundle as { apps: { studio: { label: string } } }).apps.studio.label; - it('opens with the Studio app\'s own label', () => { + it('carries a zh label, description and body', () => { + expect(zh?.label).toBeTruthy(); + expect(zh?.description).toBeTruthy(); + expect(zh?.content).toBeTruthy(); + }); + + it('each language opens with the Studio app\'s label in that language', () => { expect(STUDIO_OVERVIEW_DOC.content.startsWith(`# ${appLabel(en)} `)).toBe(true); + expect(zh!.content.startsWith(`# ${appLabel(zhCN)}`)).toBe(true); }); it('links to no page outside this package', async () => { const m = await registeredManifest(); const names = new Set(m.docs.map((d) => d.name)); - for (const text of [STUDIO_OVERVIEW_DOC.content]) { + for (const text of [STUDIO_OVERVIEW_DOC.content, zh!.content]) { for (const [, target] of text.matchAll(/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(?:#[^)\s]*)?\)/g)) { expect(names.has(target!), `the overview links to ${target}, which this package does not register`).toBe(true); } diff --git a/packages/apps/studio/src/studio-overview.doc.ts b/packages/apps/studio/src/studio-overview.doc.ts index 5d791c9d5ed..2a05811b932 100644 --- a/packages/apps/studio/src/studio-overview.doc.ts +++ b/packages/apps/studio/src/studio-overview.doc.ts @@ -80,39 +80,44 @@ Nothing you save here reaches another environment. To move it, use **Export** on the package's **Overview** page and import the file in the other environment's App Studio. `, - // zh below is still the text from before this page was corrected: the - // translation of the corrected English is pending. translations: { zh: { - label: 'Studio 概览', - description: '搭建者入门:元数据优先模型、覆盖层优先级、发布与部署。', - content: `# Studio 概览 + label: '应用搭建概览', + description: + '面向搭建者的导览:你编辑的是定义,保存会立即对所有人生效,对应用自带内容的改动保存在它旁边。', + content: `# 应用搭建概览 -Studio 是搭建者应用——塑造平台*元数据*的工作台:对象、字段、视图、流程、智能体等。 -它的大多数界面一目了然;本页讲的是那条界面上看不见、却支配你在这里一切操作的规则。 -完整参考见 。 +> **版本说明。** 开源版不包含 AI 助手。本页提到由助手撰写的草稿之处,适用于包含助手的版本。 -## 元数据优先 +应用搭建是搭建者应用:用于处理应用的对象、字段、视图、流程、权限集等的工作台。它的界面大多一目了然。 +本页介绍界面上看不到的规则。 -在 Studio 里你编辑的不是运行中的数据库,而是*定义*。每个对象、字段、视图都是一条 -元数据记录,运行的应用由这些元数据生成。这就是为什么 Studio 里的一处改动能同时重塑 -UI 和 API:你改的是模型,而不是修补某个界面。 +## 你编辑的是定义,不是数据库 -## 编辑即覆盖层(看不见的规则) +每个对象、字段和视图都是一份定义,运行中的应用由这些定义生成。 +所以在应用搭建中的一处改动,会同时改变界面和 API。 -你的改动不会原地修改某个包发布的元数据。Studio 在基础定义之上写一层**覆盖层**, -运行时按优先级解析两者:未发布的**草稿**在你编辑时对你生效,已发布的**租户覆盖层** -优先于包的基线,包基线则是兜底(ADR-0005、ADR-0033)。实际后果:基础定义永不被 -销毁,所以覆盖层总能回退以恢复原样——而一个"改不动"的字段,通常是被更高优先级的 -层遮住了。 +## 保存会立即对所有人生效 -## 发布与部署 +没有私有草稿,你自己的编辑也没有审核步骤。 -草稿只对你自己可见,直到你**发布**它,把覆盖层提升给整个租户看到。在环境之间搬运 -改动(例如开发 → 生产)是单独的**部署**步骤,不是发布的自动副作用——把两者分开, -才能让你在一个环境里安全搭建、再上线。 +- **保存即发布。** 保存一完成,改动就对所有用户生效。 +- **有风险的保存会先询问。** 如果某次保存会删除已发布的字段或更改其类型,在写入任何内容之前,会逐条指出每项改动及其对现有记录的影响。 +- **两个人编辑同一个条目。** 如果在你打开该条目之后,别人发布了它,你的保存不会覆盖他们的:系统会询问你是重新加载还是覆盖。 +- **AI 助手的改动需要等待。** 助手起草的改动不会自行生效。它们会在软件包的**概览**页面的**待发布**标签页上等待,直到你审阅并发布。 +- **还原到上次发布不是撤销。** 它会丢弃从未发布的改动,不会撤回已经发布的内容。 -草稿、覆盖层与部署的细节见 。 +## 应用自带的内容是只读的;你的改动保存在它旁边 + +应用自带的软件包不能被直接修改。当你改动其中的内容时,你的版本会保存在该应用自己的定制包中,并取代自带的版本提供服务。 + +- 自带的版本从不被改动,因此应用的更新会保留你的改动 + (见系统设置手册中的《安装与升级应用》)。 +- **恢复软件包原版**会删除你对某个条目的定制,重新提供软件包的版本。 + +## 把工作迁移到另一个环境 + +你在这里保存的内容不会到达其他环境。要迁移它,请使用软件包**概览**页面上的**导出**,并在另一个环境的应用搭建中导入该文件。 `, }, },