Skip to content

Commit 02a014b

Browse files
os-zhuangclaude
andauthored
feat(platform-objects): A3 — 用户页 Permission Sets + Business Units 分配入口 (#2920) (#2927)
sys_user 记录页新增两个纯 SDUI record:related_list tab,让管理员在单个 用户页完成三类分配:岗位(已有 Positions)、直接权限集授权、业务单元归属。 - Permission Sets: junction sys_user_permission_set(id-keyed, relationshipField=user_id),picker 绑定 sys_permission_set (linkField=permission_set_id)。 - Business Units: junction sys_business_unit_member(id-keyed, relationshipField=user_id),picker 绑定 sys_business_unit (linkField=business_unit_id,按 name 标注)。 tab 顺序 Positions → Permission Sets → Business Units,四语言标签齐全。 Claude-Session: https://claude.ai/code/session_019QRUvVfpvSycAHMMF2xTxs Co-authored-by: Claude <noreply@anthropic.com>
1 parent ed61c9b commit 02a014b

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/platform-objects': minor
3+
---
4+
5+
feat(platform-objects): sys_user 记录页新增 Permission Sets 与 Business Units 两个一站式分配 tab (A3, #2920)
6+
7+
管理员现在可在单个用户记录页完成三类分配:岗位(Positions,已有)、直接权限集授权(Permission Sets)、业务单元归属(Business Units)。两个新 tab 均为纯 SDUI 的 `record:related_list` + Add picker:
8+
9+
- **Permission Sets** — junction `sys_user_permission_set`(id-keyed,`relationshipField: 'user_id'`),Add picker 绑定 `sys_permission_set`(`linkField: 'permission_set_id'`)。服务端 audience-anchor(D5/D9)与 delegated-admin(D12)门禁的拒绝原因会显示在 Add 对话框。
10+
- **Business Units** — junction `sys_business_unit_member`(id-keyed,`relationshipField: 'user_id'`),Add picker 绑定 `sys_business_unit`(`linkField: 'business_unit_id'`,按显示字段 `name` 标注)。
11+
12+
tab 顺序为 Positions → Permission Sets → Business Units,四语言标签齐全。

packages/platform-objects/src/pages/sys-user.page.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,83 @@ export const SysUserDetailPage: Page = {
175175
},
176176
],
177177
},
178+
{
179+
// [ADR-0091 D1] Direct permission-set grants (直接授权) — pure SDUI.
180+
// sys_user_permission_set is an ordinary id-keyed junction:
181+
// user_id / permission_set_id are lookups keyed by record id, so
182+
// the list keys on `relationshipField: 'user_id'` (no
183+
// relationshipValueField). The Add picker binds a permission set by
184+
// its id (linkField: 'permission_set_id'); server-side gates
185+
// (audience-anchor D5/D9, delegated-admin D12) surface their denial
186+
// reason in the Add dialog.
187+
label: { en: 'Permission Sets', 'zh-CN': '权限集', 'ja-JP': '権限セット', 'es-ES': 'Conjuntos de permisos' },
188+
icon: 'lock',
189+
children: [
190+
{
191+
type: 'record:related_list',
192+
properties: {
193+
objectName: 'sys_user_permission_set',
194+
relationshipField: 'user_id',
195+
columns: ['permission_set_id', 'organization_id', 'granted_by', 'created_at'],
196+
sort: [{ field: 'created_at', order: 'desc' }],
197+
limit: 25,
198+
showViewAll: true,
199+
title: { en: 'Permission Sets', 'zh-CN': '权限集', 'ja-JP': '権限セット', 'es-ES': 'Conjuntos de permisos' },
200+
add: {
201+
picker: {
202+
object: 'sys_permission_set',
203+
labelField: 'label',
204+
},
205+
linkField: 'permission_set_id',
206+
label: {
207+
en: 'Grant permission set',
208+
'zh-CN': '授予权限集',
209+
'ja-JP': '権限セットを付与',
210+
'es-ES': 'Otorgar conjunto de permisos',
211+
},
212+
},
213+
},
214+
},
215+
],
216+
},
217+
{
218+
// Business-unit membership (业务单元归属) — pure SDUI.
219+
// sys_business_unit_member is an id-keyed junction: user_id /
220+
// business_unit_id are lookups keyed by record id, so the list keys
221+
// on `relationshipField: 'user_id'` (no relationshipValueField).
222+
// The Add picker binds a BU by its id (linkField: 'business_unit_id');
223+
// sys_business_unit has no `label` field so the picker labels rows by
224+
// its display field `name`.
225+
label: { en: 'Business Units', 'zh-CN': '业务单元', 'ja-JP': 'ビジネスユニット', 'es-ES': 'Unidades de negocio' },
226+
icon: 'network',
227+
children: [
228+
{
229+
type: 'record:related_list',
230+
properties: {
231+
objectName: 'sys_business_unit_member',
232+
relationshipField: 'user_id',
233+
columns: ['business_unit_id', 'function_in_business_unit', 'is_primary', 'created_at'],
234+
sort: [{ field: 'created_at', order: 'desc' }],
235+
limit: 25,
236+
showViewAll: true,
237+
title: { en: 'Business Units', 'zh-CN': '业务单元', 'ja-JP': 'ビジネスユニット', 'es-ES': 'Unidades de negocio' },
238+
add: {
239+
picker: {
240+
object: 'sys_business_unit',
241+
labelField: 'name',
242+
},
243+
linkField: 'business_unit_id',
244+
label: {
245+
en: 'Add to business unit',
246+
'zh-CN': '加入业务单元',
247+
'ja-JP': 'ビジネスユニットに追加',
248+
'es-ES': 'Añadir a unidad de negocio',
249+
},
250+
},
251+
},
252+
},
253+
],
254+
},
178255
{
179256
label: { en: 'Sessions', 'zh-CN': '会话', 'ja-JP': 'セッション', 'es-ES': 'Sesiones' },
180257
icon: 'monitor',

0 commit comments

Comments
 (0)