openxiangda 1.0.262 → 1.0.263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -415,7 +415,7 @@ openxiangda form export customer --mode package --profile dev --output ./exports
415
415
 
416
416
  运行时页面读取当前用户信息时,优先使用 `sdk.user.getCurrent<PageUserRecord>()`。用户对象会返回常规组织成员关系 `departments`,也会返回系统维护的所属单位字段 `affiliatedDepartmentId` / `affiliatedDepartment`。`departments` 表示用户真实所在的部门、班级、专业等成员关系;`affiliatedDepartment` 表示业务上用于统计、筛选和展示的归属单位,通常是学院、单位或在源单位缺失时可用的具体部门节点,不用于替代权限部门成员关系。
417
417
 
418
- 钉钉家校通讯录的家长、学生、教师身份和明确监护关系使用 `sdk.organization.schoolContact.*`(页面)或 `ctx.organization.schoolContact.*`(App Function)。角色声明 `app:organization:school-contact:read` 后默认可查询当前租户全部关系,返回平台用户 ID、手机号、钉钉 userid 和姓名;可选 `:self:read` / `:class:read` 用于收紧。完整示例见 [`docs/dingtalk-school-contact-relations.md`](docs/dingtalk-school-contact-relations.md)。
418
+ 钉钉家校通讯录的家长、学生、教师身份和明确监护关系使用 `sdk.organization.schoolContact.*`(页面)或 `ctx.organization.schoolContact.*`(App Function)。已登录非游客用户无需给应用角色额外绑定权限,默认可查询当前租户全部关系,返回平台用户 ID、手机号、钉钉 userid 和姓名;应用可显式声明 `:self:read` / `:class:read` 收紧范围。完整示例见 [`docs/dingtalk-school-contact-relations.md`](docs/dingtalk-school-contact-relations.md)。
419
419
 
420
420
  ```ts
421
421
  import type { PageUserRecord } from "openxiangda/runtime"
@@ -193,7 +193,8 @@ The lease is app-level promotion ownership, while worktree ownership prevents tw
193
193
  - Use official public SDK entrypoints and platform form/file components.
194
194
  - Read school-contact guardian/student relationships through
195
195
  `sdk.organization.schoolContact` or the trusted App Function bridge. Keep the
196
- default tenant-wide scope unless the product explicitly requires self/class
196
+ authenticated non-guest default tenant-wide scope without adding an app-role
197
+ permission binding unless the product explicitly requires self/class
197
198
  restrictions; never infer relations from department membership.
198
199
  - Report platform defects or repeated workarounds with `openxiangda feedback submit --yes` when a configured feedback channel is available.
199
200
  - Run `openxiangda update check --json` once at the start of substantial work, when a version mismatch is suspected, or when the cached check is older than one day. Do not repeat it on every confirmation turn.
@@ -19,7 +19,7 @@ Guidelines:
19
19
  - Use `sdk.export.create` and `sdk.export.get` for asynchronous XLSX exports. Simple pages may send a declarative workbook definition. Complex or reusable exports should send only a published App Function `definitionCode`, the current query snapshot, export scope, and stable selected row IDs. The server executes `structured_export_provider_v1` with fresh user permissions; never upload executable rendering code from the browser. See `docs/structured-export-v1.md`.
20
20
  - Use `AttachmentPreviewList`, `ImagePreviewGrid`, or `useFilePreview` from `openxiangda/runtime/react` for in-page attachment previews in a custom React SPA page. They use the current PageSdk context and enforce the platform capability and ticket contracts. Use `sdk.createFileAccessTicket(bucketName, objectName, fileName, "preview", { appType })` only when the page needs a shareable or new-window preview link. `appType` defaults to the current page context. Open `response.result.previewPageUrl`; do not use `previewUrl` or `/service/file/preview-by-ticket/:ticket` as the page entry.
21
21
  - Use `sdk.organization.departments.*` and `sdk.organization.accounts.*` only for intentional organization pages. Read-only list/detail pages need `app:organization:read` or `app:organization:manage`; writes and password operations need `app:organization:manage`. Do not call legacy `/user` or `/department` endpoints from pages.
22
- - Use `sdk.organization.schoolContact.*` for synchronized guardian/student relationships. Declare `app:organization:school-contact:read`; it defaults to all relationships in the current tenant. Use the optional `self:read` or `class:read` permission only when the product explicitly needs a narrower data scope. The response intentionally includes platform user ID, mobile, DingTalk userid, and name. Read `references/school-contact-relations.md` before building a family or class page.
22
+ - Use `sdk.organization.schoolContact.*` for synchronized guardian/student relationships. Authenticated non-guest users default to all relationships in the current tenant without an app-role permission binding. Use the optional `self:read` or `class:read` permission only when the product explicitly needs a narrower data scope. The response intentionally includes platform user ID, mobile, DingTalk userid, and name. Read `references/school-contact-relations.md` before building a family or class page.
23
23
  - Synchronized school-contact users also receive platform identity codes: `SCHOOL_GUARDIAN`, `SCHOOL_STUDENT`, and `SCHOOL_TEACHER`. Page permission groups select them with `platformRoleCodes` (additive to app `roles`), and runtime permissions expose them in `permissions.platformRoleCodes`. App Functions can use a `platform_roles` invocation audience and trusted `ctx.operator.platformRoleCodes`; these roles are maintained only by the daily organization sync.
24
24
  - Use `sdk.workCenter.listItems({ boxType })` and `sdk.workCenter.getStats()` for current-user work center lists and counts. `boxType` is one of `todo`, `done`, `cc`, or `initiated`. This is the end-user task/handled/cc/initiated surface; do not build todo pages by reading workflow operation logs, automation logs, or raw process-task tables.
25
25
  - `sdk.form.create` returns identifiers and generated serial number values only. Treat `formInstId` / `formInstanceId` as the required success contract; `serialNumber` / `serialNumbers` are present only when the form has `SerialNumberField`. Do not expect the save response to contain the full row, formula results, or other server-generated field values. Call `sdk.form.getDetail` explicitly after create when those values are needed.
@@ -4,7 +4,9 @@
4
4
 
5
5
  ## 权限与默认范围
6
6
 
7
- 需要查询家校关系的应用角色在 `src/resources/roles/<code>.json` 的 `apiPermissionCodes` 中声明:
7
+ 已登录非游客用户无需给应用角色绑定家校权限,默认查询当前租户的全部关系,范围为 `all`。跨租户、游客和匿名访问仍然拒绝。
8
+
9
+ 应用若要显式保留全量范围,可以在 `src/resources/roles/<code>.json` 中声明:
8
10
 
9
11
  ```json
10
12
  {
@@ -14,11 +16,13 @@
14
16
  }
15
17
  ```
16
18
 
17
- `app:organization:school-contact:read` 默认允许当前租户内全部关系,不按本人或班级限制。只有产品明确要求收紧时,才改用以下权限之一:
19
+ `app:organization:school-contact:read` 与未声明权限时的默认范围相同。只有产品明确要求收紧时,才改用以下权限之一:
18
20
 
19
21
  - `app:organization:school-contact:self:read`:只返回当前操作者作为家长或学生直接参与的关系。
20
22
  - `app:organization:school-contact:class:read`:只返回当前操作者以 `teacher` 身份加入的班级关系。
21
23
 
24
+ 同一应用角色拥有多项家校能力时按 `all > class > self` 取最宽范围。平台身份角色只表达用户身份,不参与通用应用权限计算;默认 `all` 由家校关系服务统一执行。
25
+
22
26
  默认全量可见不等于公开访问:跨租户、游客和匿名页面仍然拒绝。不要通过公开访问策略给游客授予家庭关系能力。
23
27
 
24
28
  ## 页面 SDK
@@ -36,7 +36,7 @@ openxiangda workspace publish --profile <name> --page <pageCode>
36
36
  - ✅ For external APIs use `src/resources/connectors/<code>.json` + `sdk.connector.invoke()`; for joined read-only lists use row data views + `sdk.dataView.query`; for stable dashboard metrics use aggregate data views + `sdk.dataView.stats`.
37
37
  - ✅ Choose data view `storageMode` deliberately: `materialized` for refreshed reports/lists that tolerate delay, `live` for bounded real-time multi-form reads.
38
38
  - ✅ For reusable backend orchestration use App Function (`src/functions/<functionCode>/index.ts` + `src/resources/functions/<functionCode>.json`) and call `sdk.function.invoke(code, { input })`; keep page components out of multi-table business orchestration.
39
- - ✅ 家长、学生、教师身份或监护关系页面使用 `sdk.organization.schoolContact.*`;先读 `references/school-contact-relations.md`,声明家校关系读取权限并保持服务端分页。
39
+ - ✅ 家长、学生、教师身份或监护关系页面使用 `sdk.organization.schoolContact.*`;先读 `references/school-contact-relations.md`,默认使用已登录用户的租户内全部关系,仅在业务要求时声明 self/class 收紧范围,并保持服务端分页。
40
40
  - ✅ Filters, search bars, modal forms, drawers, and inline edits use platform components for platform data fields, otherwise `antd` / `antd-mobile` controls.
41
41
  - ❌ Single-file giant pages. Split per `references/best-practices.md`.
42
42
  - ❌ Hardcoded `/view/...&isRenderNav=false` URLs scattered through page code; use the runtime navigation helper.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda",
3
- "version": "1.0.262",
3
+ "version": "1.0.263",
4
4
  "description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
5
5
  "private": false,
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  - 调查预算默认为一次覆盖完整调用链的 CodeGraph 查询,只有明确缺失符号时再补一次精确查询;普通任务只加载一个领域技能。租约、构建或部署状态未变化时不重复输出相同进度,使用 `openxiangda task status --watch` 等待状态变化。
18
18
  - 账号、角色、权限、数据范围、组织账号、RBAC、查询参数授权需求必须先运行 `openxiangda design gates --topic permissions --json`,选择 `managed-platform-account` / `existing-platform-user-assignment` / `static-role-permission` / `query-param-context`,输出权限矩阵后再实现。
19
19
  - 应用角色只读查询组织账号时声明 `app:organization:read`;创建、修改账号/部门或重置密码时声明 `app:organization:manage`。创建角色、分配成员或维护权限组也必须在角色资源的 `apiPermissionCodes` 声明对应的 `app:role:manage`、`app:page-permission-group:manage`、`app:form-permission-group:manage`。
20
- - 家校关系页面声明 `app:organization:school-contact:read` 并调用 `sdk.organization.schoolContact.*`;默认范围是当前租户全部关系。只有明确需要本人或任教班级限制时才改用 `:self:read` / `:class:read`。
20
+ - 家校关系页面调用 `sdk.organization.schoolContact.*`;已登录非游客用户无需绑定应用角色权限,默认范围是当前租户全部关系。只有明确需要本人或任教班级限制时才声明 `:self:read` / `:class:read`。
21
21
  - 默认用户界面保持克制:左侧应用导航、顶部账号信息、首页内容区域。
22
22
  - 不在默认可见页面展示 SDK、Runtime、Cookie、Proxy、Playwright、AI 验证、调试上下文、构建号等开发语言。
23
23
  - 使用 React Router 管理路由,路由定义在 `src/app/router.tsx`。
@@ -51,7 +51,7 @@ Delivery V2 自动从期望状态按资源指纹计算精确范围,使用 CLI
51
51
  - ✅ L2/L3 保留 context → propose → 用户确认 → approve;默认只创建 change/coverage/release,完整文档由 `sdd render` 按需生成。approval、coverage 与实际发布范围为硬门禁,未完成的任务/证据/规格文案只告警。需要严格文档门禁时显式配置 `strictDocumentation: true`。
52
52
  - ✅ 涉及账号、角色、权限、数据范围、组织账号、RBAC、查询参数授权时,先跑 `openxiangda design gates --topic permissions --json`,选择 `managed-platform-account` / `existing-platform-user-assignment` / `static-role-permission` / `query-param-context`,并输出权限矩阵后再改资源。
53
53
  - ✅ 某个应用角色如果要查询组织账号,声明 `app:organization:read`;如需创建、修改账号/部门或重置密码,再声明 `app:organization:manage`。角色设置、页面/表单权限组等能力同样通过 `src/resources/roles/<code>.json` 的 `apiPermissionCodes` 显式授权,例如 `app:role:manage`、`app:page-permission-group:manage`、`app:form-permission-group:manage`。
54
- - ✅ 查询家校通讯录的家长、学生、教师身份和监护关系时声明 `app:organization:school-contact:read`,并使用 `sdk.organization.schoolContact.*` / `ctx.organization.schoolContact.*`。该权限默认查询当前租户全部关系;只有明确要求时才改用 `:self:read` 或 `:class:read` 收紧。
54
+ - ✅ 查询家校通讯录的家长、学生、教师身份和监护关系时使用 `sdk.organization.schoolContact.*` / `ctx.organization.schoolContact.*`。已登录非游客用户无需绑定应用角色权限,默认查询当前租户全部关系;只有明确要求时才声明 `:self:read` 或 `:class:read` 收紧。
55
55
  - ✅ 单文件改动默认按 change 和逻辑资源增量发布:`workspace plan --profile <name> --change <change> --changed`,再 `workspace publish --profile <name> --change <change> --only pages/a,forms/b --dry-run` → 正式发布。
56
56
  - ✅ 用户 token 在 `~/.openxiangda/profiles.json`;项目 state 在 `.openxiangda/state.json`(只存 ID)。
57
57
  - ✅ 共享环境(`APP_OSS_*`、反馈机器人等)在 `~/.openxiangda/.env`,项目 `.env` 仅做 per-workspace override。