openxiangda 1.0.13 → 1.0.14
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/lib/cli.js
CHANGED
|
@@ -1946,14 +1946,14 @@ function resolvePagePermissionMenuTargets(bound, flags = {}) {
|
|
|
1946
1946
|
function resolveMenuPermissionTargets(bound, menuCode) {
|
|
1947
1947
|
const menuEntry = bound.resources?.menus?.[menuCode];
|
|
1948
1948
|
if (menuEntry?.formUuid) return [menuEntry.formUuid];
|
|
1949
|
-
if (menuEntry?.pageId) return [menuEntry.
|
|
1949
|
+
if (menuEntry?.pageId && menuEntry?.menuId) return [menuEntry.menuId];
|
|
1950
1950
|
return [resolveMenuId(bound, menuCode)];
|
|
1951
1951
|
}
|
|
1952
1952
|
|
|
1953
1953
|
function resolvePagePermissionTargets(bound, pageCode) {
|
|
1954
1954
|
const menuEntry = findPagePermissionMenuEntry(bound, pageCode);
|
|
1955
|
-
if (menuEntry?.
|
|
1956
|
-
return [menuEntry.
|
|
1955
|
+
if (menuEntry?.menuId) {
|
|
1956
|
+
return [menuEntry.menuId];
|
|
1957
1957
|
}
|
|
1958
1958
|
fail(`页面 ${pageCode} 未找到已绑定代码页菜单。请先发布/创建菜单,或直接传 --menu-form-uuids/--menu-ids。`);
|
|
1959
1959
|
}
|
|
@@ -2001,7 +2001,7 @@ function resolveCodePagePermissionAliases(bound, menuEntry = {}, pageCode) {
|
|
|
2001
2001
|
});
|
|
2002
2002
|
return unique([
|
|
2003
2003
|
pageCode,
|
|
2004
|
-
menuEntry.
|
|
2004
|
+
menuEntry.pageId,
|
|
2005
2005
|
menuEntry.pageCode,
|
|
2006
2006
|
menuEntry.routeKey,
|
|
2007
2007
|
menuEntry.legacyFormUuid,
|
|
@@ -369,11 +369,11 @@ Body:
|
|
|
369
369
|
{
|
|
370
370
|
"name": "销售可见页面",
|
|
371
371
|
"roles": ["sales"],
|
|
372
|
-
"menuFormUuids": ["FORM_XXX", "
|
|
372
|
+
"menuFormUuids": ["FORM_XXX", "MENU_ID_FOR_CODE_PAGE"]
|
|
373
373
|
}
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
An empty `menuFormUuids` array means all menus/pages are visible to the matched roles. For form menus this field can contain form UUIDs. For custom code page menus, the user-facing permission group should contain the
|
|
376
|
+
An empty `menuFormUuids` array means all menus/pages are visible to the matched roles. For form menus this field can contain form UUIDs. For custom code page menus, the user-facing permission group should contain the platform menu ID, which is what the platform permission editor uses for tree check state. Because some `/view` runtime guards also check page IDs, route keys, and legacy `PAGE_...` aliases, OpenXiangda CLI `--page-codes` / `--menu-codes` creates a companion `(运行时别名)` page permission group for those aliases instead of mixing them into the editable menu group.
|
|
377
377
|
|
|
378
378
|
### GET `/apps/:appType/page-permission-groups/:groupId`
|
|
379
379
|
|
|
@@ -20,25 +20,25 @@ Role IDs are platform-specific. Store them only in `.openxiangda/state.json` und
|
|
|
20
20
|
|
|
21
21
|
Page permission groups map role codes to visible menu targets. Form menus use their `FORM_...`
|
|
22
22
|
form UUIDs. Custom code page/display menus need split targets because current platform
|
|
23
|
-
surfaces check different identifiers: the admin edit tree expects
|
|
24
|
-
runtime
|
|
23
|
+
surfaces check different identifiers: the admin edit tree expects menu IDs, while some `/view`
|
|
24
|
+
runtime guards check page IDs, route keys, and legacy `PAGE_...` aliases.
|
|
25
25
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
28
|
"name": "销售页面",
|
|
29
29
|
"roles": ["sales"],
|
|
30
|
-
"menuFormUuids": ["FORM_CUSTOMER", "FORM_ORDER", "
|
|
30
|
+
"menuFormUuids": ["FORM_CUSTOMER", "FORM_ORDER", "MENU_ID_FOR_CODE_PAGE"]
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
For custom code pages, keep the user-facing group editable by storing only
|
|
34
|
+
For custom code pages, keep the user-facing group editable by storing only menu IDs, then add a
|
|
35
35
|
companion runtime alias group with the same roles:
|
|
36
36
|
|
|
37
37
|
```json
|
|
38
38
|
{
|
|
39
39
|
"name": "销售页面(运行时别名)",
|
|
40
40
|
"roles": ["sales"],
|
|
41
|
-
"menuFormUuids": ["
|
|
41
|
+
"menuFormUuids": ["PAGE_ID_FOR_CODE_PAGE", "CODE_PAGE_ROUTE_KEY", "PAGE_LEGACY_FORM_UUID"]
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ Rules:
|
|
|
47
47
|
- `roles: []` means all roles can match.
|
|
48
48
|
- `menuFormUuids: []` means all menus/pages are visible to matched roles.
|
|
49
49
|
- Prefer `--form-codes` in CLI for form menus so each profile resolves its own form UUIDs.
|
|
50
|
-
- Prefer `--page-codes` or `--menu-codes` in CLI for custom code page menus. The CLI writes
|
|
50
|
+
- Prefer `--page-codes` or `--menu-codes` in CLI for custom code page menus. The CLI writes menu IDs to the editable group and creates the companion `(运行时别名)` group automatically.
|
|
51
51
|
|
|
52
52
|
## Form Permission Groups
|
|
53
53
|
|