openxiangda 1.0.12 → 1.0.13
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
|
@@ -1945,17 +1945,17 @@ function resolvePagePermissionMenuTargets(bound, flags = {}) {
|
|
|
1945
1945
|
|
|
1946
1946
|
function resolveMenuPermissionTargets(bound, menuCode) {
|
|
1947
1947
|
const menuEntry = bound.resources?.menus?.[menuCode];
|
|
1948
|
-
const menuId = resolveMenuId(bound, menuCode);
|
|
1949
1948
|
if (menuEntry?.formUuid) return [menuEntry.formUuid];
|
|
1950
|
-
return [
|
|
1949
|
+
if (menuEntry?.pageId) return [menuEntry.pageId];
|
|
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?.pageId) {
|
|
1956
|
+
return [menuEntry.pageId];
|
|
1957
1957
|
}
|
|
1958
|
-
fail(`页面 ${pageCode}
|
|
1958
|
+
fail(`页面 ${pageCode} 未找到已绑定代码页菜单。请先发布/创建菜单,或直接传 --menu-form-uuids/--menu-ids。`);
|
|
1959
1959
|
}
|
|
1960
1960
|
|
|
1961
1961
|
function resolvePagePermissionRuntimeAliasTargets(bound, flags = {}) {
|
|
@@ -2001,9 +2001,11 @@ function resolveCodePagePermissionAliases(bound, menuEntry = {}, pageCode) {
|
|
|
2001
2001
|
});
|
|
2002
2002
|
return unique([
|
|
2003
2003
|
pageCode,
|
|
2004
|
+
menuEntry.menuId,
|
|
2004
2005
|
menuEntry.pageCode,
|
|
2005
2006
|
menuEntry.routeKey,
|
|
2006
2007
|
menuEntry.legacyFormUuid,
|
|
2008
|
+
pageEntry?.pageId,
|
|
2007
2009
|
pageEntry?.pageCode,
|
|
2008
2010
|
pageEntry?.routeKey,
|
|
2009
2011
|
pageEntry?.legacyFormUuid,
|
|
@@ -369,11 +369,11 @@ Body:
|
|
|
369
369
|
{
|
|
370
370
|
"name": "销售可见页面",
|
|
371
371
|
"roles": ["sales"],
|
|
372
|
-
"menuFormUuids": ["FORM_XXX", "
|
|
372
|
+
"menuFormUuids": ["FORM_XXX", "PAGE_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
|
|
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 code page `pageId`, which is what the platform permission editor uses for tree check state. Because the current `/view` runtime guard also checks menu 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 checks route keys and legacy `PAGE_...` aliases.
|
|
23
|
+
surfaces check different identifiers: the admin edit tree expects page IDs, while `/view`
|
|
24
|
+
runtime checks menu 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", "PAGE_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 page 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": ["CODE_PAGE_ROUTE_KEY", "PAGE_LEGACY_FORM_UUID"]
|
|
41
|
+
"menuFormUuids": ["MENU_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 page IDs to the editable group and creates the companion `(运行时别名)` group automatically.
|
|
51
51
|
|
|
52
52
|
## Form Permission Groups
|
|
53
53
|
|
|
@@ -43,7 +43,7 @@ openxiangda permission page-group-create sales_pages --name "销售页面" --rol
|
|
|
43
43
|
openxiangda permission page-group-create portal_pages --name "门户页面" --page-codes portal_pc,portal_mobile --profile dev
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Use `--page-codes` or `--menu-codes` for custom code page menus; the CLI resolves
|
|
46
|
+
Use `--page-codes` or `--menu-codes` for custom code page menus; the CLI resolves the editable permission group to the published code page `pageId`, and creates a companion `(运行时别名)` group for the menu ID, route key, and legacy `PAGE_...` alias required by the platform's current `/view` guard and custom-page bootstrap checks. Use `--form-codes` for form menus; the CLI resolves forms to profile-local form UUIDs. Empty target lists mean all menus/pages are visible to matched roles.
|
|
47
47
|
|
|
48
48
|
## Form Permission Groups
|
|
49
49
|
|