@pubinfo/module-rbac 2.1.0 → 2.1.1
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/dist/{MetaForm-CdjGvTzO.js → MetaForm-BMPtZc0g.js} +1698 -1672
- package/dist/{ResourceEdit-DmhCeCzZ.js → ResourceEdit-D59JUDvG.js} +1 -1
- package/dist/{ResourceEdit.vue_vue_type_script_setup_true_lang-Bf5bFQcG.js → ResourceEdit.vue_vue_type_script_setup_true_lang-IWn27Vz1.js} +1 -1
- package/dist/{index-C2G4xRrJ.js → index-BH3LYln0.js} +1 -1
- package/dist/{index-B0zXLUdu.js → index-CGLg7J6G.js} +1 -1
- package/dist/{index-CW5BpDeG.js → index-DQhQqT_Z.js} +1 -1
- package/dist/index.js +9 -9
- package/dist/index14.css +1 -1
- package/dist/index15.css +1 -1
- package/dist/utils/validateObjectStructure.d.ts +11 -0
- package/package.json +3 -3
- package/src/components/JsonEditorModal/index.vue +8 -3
- package/src/utils/validateObjectStructure.ts +47 -0
|
@@ -7,7 +7,7 @@ import { ProTable as de } from "@pubinfo/pro-components";
|
|
|
7
7
|
import { Popover as pe, Space as _e, Badge as V, Modal as M, message as N } from "ant-design-vue";
|
|
8
8
|
import fe from "./UserAuthorization-Ch_iKzms.js";
|
|
9
9
|
import { A as t, _ as me } from "./UserEdit.vue_vue_type_script_setup_true_lang-SIR1ZO_N.js";
|
|
10
|
-
import './
|
|
10
|
+
import './index14.css';const he = { class: "flex w-full items-center overflow-hidden" }, ge = ["title"], ve = /* @__PURE__ */ z({
|
|
11
11
|
name: "OrgTree",
|
|
12
12
|
__name: "index",
|
|
13
13
|
props: {
|
|
@@ -7,7 +7,7 @@ import { useAuth as j, PubinfoIcon as I, RESOURCE_TYPE as T } from "pubinfo";
|
|
|
7
7
|
import "./index.js";
|
|
8
8
|
import { b as G, c as J } from "./ziyuanjiekou-BC65-bFK.js";
|
|
9
9
|
import { _ as Q } from "./ImportExport.vue_vue_type_script_setup_true_lang-CV0DrMvw.js";
|
|
10
|
-
import { _ as W } from "./ResourceEdit.vue_vue_type_script_setup_true_lang-
|
|
10
|
+
import { _ as W } from "./ResourceEdit.vue_vue_type_script_setup_true_lang-IWn27Vz1.js";
|
|
11
11
|
import { _ as Z } from "./RoleRelation.vue_vue_type_script_setup_true_lang-BjEOlM2g.js";
|
|
12
12
|
import { r as L, A as t, R as ee } from "./enum-D5iPiZiT.js";
|
|
13
13
|
import { c as te } from "./cloneDeep-BOLZdR62.js";
|
package/dist/index.js
CHANGED
|
@@ -75,17 +75,17 @@ import './index17.css';const wa = {
|
|
|
75
75
|
"src/views/page_w_setting/index.vue": () => import("./index-XhYtVVT9.js"),
|
|
76
76
|
"src/views/position/index.vue": () => import("./index-iBmBJd50.js"),
|
|
77
77
|
"src/views/region/index.vue": () => import("./index-BhZNbJp6.js"),
|
|
78
|
-
"src/views/resource/index.vue": () => import("./index-
|
|
78
|
+
"src/views/resource/index.vue": () => import("./index-DQhQqT_Z.js"),
|
|
79
79
|
"src/views/role/index.vue": () => import("./index-ChWnVs6j.js"),
|
|
80
80
|
"src/views/role_group/index.vue": () => import("./index-CJQB8KAz.js"),
|
|
81
81
|
"src/views/safe_setting/index.vue": () => import("./index-VZuizuKs.js"),
|
|
82
82
|
"src/views/tabbar_setting/index.vue": () => import("./index-BEB4liGe.js"),
|
|
83
83
|
"src/views/tenant/index.vue": () => import("./index-CoZM8pyH.js"),
|
|
84
84
|
"src/views/theme_setting/index.vue": () => import("./index-B5aP0re3.js"),
|
|
85
|
-
"src/views/
|
|
86
|
-
"src/views/
|
|
87
|
-
"src/views/watermark_setting/index.vue": () => import("./index-DHVEXch0.js"),
|
|
85
|
+
"src/views/user/index.vue": () => import("./index-CGLg7J6G.js"),
|
|
86
|
+
"src/views/toolbar_setting/index.vue": () => import("./index-BH3LYln0.js"),
|
|
88
87
|
"src/views/blackWhiteList/components/drawerBlackWhiteList.vue": () => import("./drawerBlackWhiteList-eWyKScZN.js"),
|
|
88
|
+
"src/views/watermark_setting/index.vue": () => import("./index-DHVEXch0.js"),
|
|
89
89
|
"src/views/data-permission/components/createAndEditDataPermission.vue": () => import("./createAndEditDataPermission-DPeFulie.js"),
|
|
90
90
|
"src/views/dictionary/components/drawerDictionary.vue": () => import("./drawerDictionary-BRGmcIFT.js"),
|
|
91
91
|
"src/views/dictionary/components/drawerDictionaryItem.vue": () => import("./drawerDictionaryItem-CFBfyhEw.js"),
|
|
@@ -103,8 +103,8 @@ import './index17.css';const wa = {
|
|
|
103
103
|
"src/views/resource/components/IconSelect.vue": () => import("./IconSelect-DtNpk3Rj.js"),
|
|
104
104
|
"src/views/resource/components/ImportExport.vue": () => import("./ImportExport-DAe_Sl13.js"),
|
|
105
105
|
"src/views/resource/components/LayoutForm.vue": () => import("./LayoutForm-Pv6UyKl3.js"),
|
|
106
|
-
"src/views/resource/components/MetaForm.vue": () => import("./MetaForm-
|
|
107
|
-
"src/views/resource/components/ResourceEdit.vue": () => import("./ResourceEdit-
|
|
106
|
+
"src/views/resource/components/MetaForm.vue": () => import("./MetaForm-BMPtZc0g.js").then((e) => e.a),
|
|
107
|
+
"src/views/resource/components/ResourceEdit.vue": () => import("./ResourceEdit-D59JUDvG.js"),
|
|
108
108
|
"src/views/resource/components/RoleRelation.vue": () => import("./RoleRelation-BuqK0cnl.js"),
|
|
109
109
|
"src/views/role/components/ResourceRelation.vue": () => import("./ResourceRelation-qhIdXLAy.js"),
|
|
110
110
|
"src/views/role/components/drawerRole.vue": () => import("./drawerRole-CfJjf3v_.js"),
|
|
@@ -1455,7 +1455,7 @@ const Qd = {
|
|
|
1455
1455
|
children: [
|
|
1456
1456
|
{
|
|
1457
1457
|
path: "resource",
|
|
1458
|
-
component: () => import("./index-
|
|
1458
|
+
component: () => import("./index-DQhQqT_Z.js"),
|
|
1459
1459
|
name: "Resource",
|
|
1460
1460
|
meta: {
|
|
1461
1461
|
title: "资源管理",
|
|
@@ -1510,7 +1510,7 @@ const Qd = {
|
|
|
1510
1510
|
},
|
|
1511
1511
|
{
|
|
1512
1512
|
path: "user",
|
|
1513
|
-
component: () => import("./index-
|
|
1513
|
+
component: () => import("./index-CGLg7J6G.js"),
|
|
1514
1514
|
name: "User",
|
|
1515
1515
|
meta: {
|
|
1516
1516
|
title: "用户管理",
|
|
@@ -1694,7 +1694,7 @@ const Qd = {
|
|
|
1694
1694
|
},
|
|
1695
1695
|
{
|
|
1696
1696
|
path: "toolbar-setting",
|
|
1697
|
-
component: () => import("./index-
|
|
1697
|
+
component: () => import("./index-BH3LYln0.js"),
|
|
1698
1698
|
name: "ToolbarSetting",
|
|
1699
1699
|
meta: {
|
|
1700
1700
|
title: "工具栏配置",
|
package/dist/index14.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
[data-v-3c42fd2d] .ant-tree .ant-tree-node-content-wrapper{overflow:hidden}
|
package/dist/index15.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[data-v-
|
|
1
|
+
.bar-header[data-v-dc8e4487]{background:var(--g-bg)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ValidateOptions {
|
|
2
|
+
/** 允许的最大嵌套层级(含根层) */
|
|
3
|
+
maxDepth?: number;
|
|
4
|
+
/** 每一层最多 key 数 */
|
|
5
|
+
maxKeysPerLevel?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ValidateResult {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
errors: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function validateObjectStructure(obj: any, options?: ValidateOptions): ValidateResult;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/module-rbac",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@pubinfo/pro-components": "^1.8.0",
|
|
25
25
|
"alova": "^3.3.4",
|
|
26
26
|
"ant-design-vue": "^4.2.6",
|
|
27
|
-
"pubinfo": "2.1.
|
|
27
|
+
"pubinfo": "2.1.1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@destyler/color-picker": "^0.1.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"alova": "^3.3.4",
|
|
50
50
|
"ant-design-vue": "^4.2.6",
|
|
51
51
|
"type-fest": "^4.41.0",
|
|
52
|
-
"pubinfo": "2.1.
|
|
52
|
+
"pubinfo": "2.1.1"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"dev": "pubinfo build -w --sourcemap",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useToggle } from '@vueuse/core';
|
|
3
3
|
import { message } from 'ant-design-vue';
|
|
4
4
|
import JsonEditorVue from 'json-editor-vue';
|
|
5
|
+
import { validateObjectStructure } from '@/utils/validateObjectStructure';
|
|
5
6
|
|
|
6
7
|
defineOptions({
|
|
7
8
|
name: 'JsonEditorModal',
|
|
@@ -20,10 +21,14 @@ watchEffect(() => {
|
|
|
20
21
|
function onFinish() {
|
|
21
22
|
try {
|
|
22
23
|
const parseValue = JSON.parse(inputValue.value);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const { valid, errors } = validateObjectStructure(parseValue, { maxDepth: 2, maxKeysPerLevel: 8 });
|
|
25
|
+
if (!valid || !parseValue) {
|
|
26
|
+
message.info(errors[0]);
|
|
27
|
+
return;
|
|
26
28
|
}
|
|
29
|
+
|
|
30
|
+
modelValue.value = parseValue;
|
|
31
|
+
toggle(false);
|
|
27
32
|
}
|
|
28
33
|
catch (_) {
|
|
29
34
|
message.info('JSON数据格式错误');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface ValidateOptions {
|
|
2
|
+
/** 允许的最大嵌套层级(含根层) */
|
|
3
|
+
maxDepth?: number
|
|
4
|
+
/** 每一层最多 key 数 */
|
|
5
|
+
maxKeysPerLevel?: number
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ValidateResult {
|
|
9
|
+
valid: boolean
|
|
10
|
+
errors: string[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function validateObjectStructure(
|
|
14
|
+
obj: any,
|
|
15
|
+
options: ValidateOptions = {},
|
|
16
|
+
): ValidateResult {
|
|
17
|
+
const { maxDepth = 3, maxKeysPerLevel = 10 } = options;
|
|
18
|
+
const errors: string[] = [];
|
|
19
|
+
|
|
20
|
+
function traverse(value: any, depth: number, path: string) {
|
|
21
|
+
if (depth > maxDepth) {
|
|
22
|
+
errors.push(`对象嵌套层级超过限制,最大允许 ${maxDepth} 层。问题位置: ${path}`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
27
|
+
const keys = Object.keys(value);
|
|
28
|
+
|
|
29
|
+
if (keys.length > maxKeysPerLevel) {
|
|
30
|
+
errors.push(
|
|
31
|
+
`对象包含过多字段(${keys.length} 个),最大允许 ${maxKeysPerLevel} 个。位置: ${path}`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
keys.forEach((key) => {
|
|
36
|
+
traverse(value[key], depth + 1, `${path}.${key}`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
traverse(obj, 1, 'root');
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
valid: errors.length === 0,
|
|
45
|
+
errors,
|
|
46
|
+
};
|
|
47
|
+
}
|