@steedos/service-core-objects 3.0.0-beta.103 → 3.0.0-beta.104
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/main/default/objects/_base/base.object.js +1 -1
- package/main/default/objects/permission_set/buttons/copy.button.yml +114 -0
- package/main/default/objects/permission_set/buttons/set_permission_tabs.button.yml +166 -0
- package/package.json +3 -3
- /package/main/default/objects/{permission_set.object.yml → permission_set/permission_set.object.yml} +0 -0
|
@@ -14,7 +14,7 @@ var standardCustomizeSaveRequestAdaptor = `
|
|
|
14
14
|
delete newDoc.responseStatus;
|
|
15
15
|
}
|
|
16
16
|
else if(objectName === "permission_set"){
|
|
17
|
-
objectFields = ['name', 'label', 'type', 'license', 'lockout_interval', 'max_login_attempts', 'password_history', 'default_standard_buttons'];
|
|
17
|
+
objectFields = ['name', 'label', 'type', 'license', 'lockout_interval', 'max_login_attempts', 'password_history', 'default_standard_buttons', 'assigned_apps'];
|
|
18
18
|
_.each(objectFields, function(v, k){
|
|
19
19
|
if(_.has(doc, v)){
|
|
20
20
|
newDoc[v] = doc[v];
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
name: copy
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "${'permission_set.copy.copy' | t}",
|
|
9
|
+
"id": "u:copy",
|
|
10
|
+
"onEvent": {
|
|
11
|
+
"click": {
|
|
12
|
+
"weight": 0,
|
|
13
|
+
"actions": [
|
|
14
|
+
{
|
|
15
|
+
"dialog": {
|
|
16
|
+
"type": "dialog",
|
|
17
|
+
"title": "${'permission_set.copy.copy_record' | t}",
|
|
18
|
+
"body": [
|
|
19
|
+
{
|
|
20
|
+
"type": "form",
|
|
21
|
+
"title": "表单",
|
|
22
|
+
"body": [
|
|
23
|
+
{
|
|
24
|
+
"label": "${'permission_set.copy.display_name' | t}",
|
|
25
|
+
"type": "input-text",
|
|
26
|
+
"value": "${'permission_set.copy.copy_of_record' | t:${record.label}}",
|
|
27
|
+
"name": "label_input",
|
|
28
|
+
"id": "u:24e89a11d437",
|
|
29
|
+
"required": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "input-text",
|
|
33
|
+
"name": "name_input",
|
|
34
|
+
"value": "${record.name}_copy",
|
|
35
|
+
"label": "${'permission_set.copy.api_name' | t}",
|
|
36
|
+
"id": "u:27bd7cfe3e12",
|
|
37
|
+
"required": true
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"api": {
|
|
41
|
+
"url": "${context.rootUrl}/api/permission/permission_set/copy",
|
|
42
|
+
"method": "post",
|
|
43
|
+
"messages": {
|
|
44
|
+
"success": "复制成功"
|
|
45
|
+
},
|
|
46
|
+
"requestAdaptor": "delete api.body.label_input;\ndelete api.body.name_input;",
|
|
47
|
+
"data": {
|
|
48
|
+
"&": "$$",
|
|
49
|
+
"label": "${label_input}",
|
|
50
|
+
"name": "${name_input}",
|
|
51
|
+
"originalPermissionSetId": "${record._id}"
|
|
52
|
+
},
|
|
53
|
+
"headers": {
|
|
54
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"onEvent": {
|
|
58
|
+
"submitSucc": {
|
|
59
|
+
"weight": 0,
|
|
60
|
+
"actions": [
|
|
61
|
+
{
|
|
62
|
+
"args": {
|
|
63
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/view/${result.data.recordId}",
|
|
64
|
+
"blank": false
|
|
65
|
+
},
|
|
66
|
+
"actionType": "url"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"id": "u:818f7b68417b",
|
|
72
|
+
"mode": "normal"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"showCloseButton": true,
|
|
76
|
+
"showErrorMsg": true,
|
|
77
|
+
"showLoading": true,
|
|
78
|
+
"id": "u:9f9b042404a1",
|
|
79
|
+
"closeOnEsc": false,
|
|
80
|
+
"dataMapSwitch": false,
|
|
81
|
+
"size": "md"
|
|
82
|
+
},
|
|
83
|
+
"actionType": "dialog"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"regions": [
|
|
91
|
+
"body"
|
|
92
|
+
],
|
|
93
|
+
"data": {
|
|
94
|
+
"context": {},
|
|
95
|
+
"app_id": "",
|
|
96
|
+
"tab_id": "",
|
|
97
|
+
"object_name": "",
|
|
98
|
+
"dataComponentId": "",
|
|
99
|
+
"record_id": "",
|
|
100
|
+
"record": {},
|
|
101
|
+
"permissions": {}
|
|
102
|
+
},
|
|
103
|
+
"bodyClassName": "p-0",
|
|
104
|
+
"id": "u:4b81eda72f12"
|
|
105
|
+
}
|
|
106
|
+
is_enable: true
|
|
107
|
+
label: 复制
|
|
108
|
+
'on': record_only
|
|
109
|
+
type: amis_button
|
|
110
|
+
visible: !!js/function |
|
|
111
|
+
function (object_name, record_id, record_permissions, record) {
|
|
112
|
+
|
|
113
|
+
return record.record.type == 'profile';
|
|
114
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
name: set_permission_tabs
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "${'permission_set.set_permission_tabs.set_permission' | t}",
|
|
9
|
+
"id": "u:set_permission_tabs",
|
|
10
|
+
"onEvent": {
|
|
11
|
+
"click": {
|
|
12
|
+
"actions": [
|
|
13
|
+
{
|
|
14
|
+
"actionType": "dialog",
|
|
15
|
+
"dialog": {
|
|
16
|
+
"type": "dialog",
|
|
17
|
+
"title": "${'permission_set.set_permission_tabs.set_permission' | t}",
|
|
18
|
+
"body": [
|
|
19
|
+
{
|
|
20
|
+
"type": "form",
|
|
21
|
+
"id": "u:2281889ba1e7",
|
|
22
|
+
"body": [
|
|
23
|
+
{
|
|
24
|
+
"type": "input-table",
|
|
25
|
+
"id": "u:1516aff9070c",
|
|
26
|
+
"name": "permission_tabs_list",
|
|
27
|
+
"label": "",
|
|
28
|
+
"columns": [
|
|
29
|
+
{
|
|
30
|
+
"label": "${'permission_set.set_permission_tabs.tab' | t}",
|
|
31
|
+
"name": "tab.label",
|
|
32
|
+
"type": "text",
|
|
33
|
+
"id": "u:ebd95b18057a",
|
|
34
|
+
"placeholder": "-"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"label": "${'permission_set.set_permission_tabs.permission' | t}",
|
|
38
|
+
"name": "permission",
|
|
39
|
+
"type": "select",
|
|
40
|
+
"id": "u:ad5dcb76754f",
|
|
41
|
+
"options": [
|
|
42
|
+
{
|
|
43
|
+
"label": "默认打开",
|
|
44
|
+
"value": "on"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"label": "默认关闭",
|
|
48
|
+
"value": "off"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"value": "on"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"strictMode": true,
|
|
55
|
+
"disabled": false,
|
|
56
|
+
"mode": "normal"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"messages": {},
|
|
60
|
+
"initApi": {
|
|
61
|
+
"method": "post",
|
|
62
|
+
"url": "${context.rootUrl}/graphql",
|
|
63
|
+
"data": {
|
|
64
|
+
"&": "$$",
|
|
65
|
+
"record": "${record}"
|
|
66
|
+
},
|
|
67
|
+
"adaptor": "const data = payload.data\nconst { permission_tabs, tabs } = data\nconst tableOptions = []\nconst tabNames = [] // 用于存储已经遍历过的选项卡,防止重复\nfor (const pTab of permission_tabs) {\n tableOptions.push({\n tab: {\n _id: pTab.tab__expand?._id,\n name: pTab.tab__expand?.name,\n label: pTab.tab__expand?.label\n },\n permission: pTab.permission\n })\n tabNames.push(pTab.tab__expand?.name)\n}\n\nfor (const tab of tabs) {\n if (tabNames.includes(tab.name)) {\n continue\n }\n tableOptions.push({\n tab: {\n _id: tab._id,\n name: tab.name,\n label: tab.label\n },\n permission: 'on'\n })\n}\n\ndata.permission_tabs_list = tableOptions\n\nreturn payload\n",
|
|
68
|
+
"headers": {
|
|
69
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
70
|
+
},
|
|
71
|
+
"requestAdaptor": "const record = api.body.record\napi.data.query = `\n{\n permission_tabs(filters: [[\"permission_set\", \"=\", \"${record.name}\"]]) {\n _id\n permission\n tab__expand {\n _id\n name\n label\n }\n }\n tabs {\n _id\n name\n label\n }\n}\n`\ndelete api.body.record;\nreturn api;",
|
|
72
|
+
"dataType": "json"
|
|
73
|
+
},
|
|
74
|
+
"api": {
|
|
75
|
+
"method": "post",
|
|
76
|
+
"url": "${context.rootUrl}/api/permission/permission_set/batchSavePermissionTabs",
|
|
77
|
+
"data": {
|
|
78
|
+
"&": "$$",
|
|
79
|
+
"record": "${record}",
|
|
80
|
+
"record_id": "${record_id}"
|
|
81
|
+
},
|
|
82
|
+
"requestAdaptor": "api.data.permission_set_name = api.data.record.name\ndelete api.data.permission_tabs\ndelete api.data.record\ndelete api.data.tabs\n\nreturn api",
|
|
83
|
+
"dataType": "json"
|
|
84
|
+
},
|
|
85
|
+
"onEvent": {
|
|
86
|
+
"submitSucc": {
|
|
87
|
+
"weight": 0,
|
|
88
|
+
"actions": [
|
|
89
|
+
{
|
|
90
|
+
"actionType": "custom",
|
|
91
|
+
"script": "/* 自定义JS使用说明: \n * 1.动作执行函数doAction,可以执行所有类型的动作\n * 2.通过上下文对象context可以获取当前组件实例,例如context.props可以获取该组件相关属性\n * 3.事件对象event,在doAction之后执行event.stopPropagation = true;可以阻止后续动作执行\n*/\n\nSteedosUI.router.go({ objectName: 'permission_set', recordId: context.props.data.record_id, type: 'edit' });\n"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"id": "u:5d6ebd078296",
|
|
99
|
+
"closeOnEsc": false,
|
|
100
|
+
"closeOnOutside": false,
|
|
101
|
+
"showCloseButton": true,
|
|
102
|
+
"data": null,
|
|
103
|
+
"size": "lg",
|
|
104
|
+
"actions": [
|
|
105
|
+
{
|
|
106
|
+
"type": "button",
|
|
107
|
+
"label": "${'permission_set.set_permission_tabs.cancel' | t}",
|
|
108
|
+
"onEvent": {
|
|
109
|
+
"click": {
|
|
110
|
+
"actions": [
|
|
111
|
+
{
|
|
112
|
+
"componentId": "",
|
|
113
|
+
"args": {},
|
|
114
|
+
"actionType": "closeDialog"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"id": "u:f1b8dabafee5",
|
|
120
|
+
"level": "default"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "submit",
|
|
124
|
+
"label": "${'permission_set.set_permission_tabs.save' | t}",
|
|
125
|
+
"onEvent": {},
|
|
126
|
+
"id": "u:246398c1f14c",
|
|
127
|
+
"level": "primary",
|
|
128
|
+
"close": true,
|
|
129
|
+
"hidden": false
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"weight": 0
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"level": "enhance"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"regions": [
|
|
142
|
+
"body"
|
|
143
|
+
],
|
|
144
|
+
"data": {
|
|
145
|
+
"context": {
|
|
146
|
+
"rootUrl": "http://127.0.0.1:5100"
|
|
147
|
+
},
|
|
148
|
+
"app_id": "",
|
|
149
|
+
"tab_id": "",
|
|
150
|
+
"object_name": "",
|
|
151
|
+
"dataComponentId": "",
|
|
152
|
+
"record_id": "",
|
|
153
|
+
"record": {},
|
|
154
|
+
"permissions": {}
|
|
155
|
+
},
|
|
156
|
+
"id": "u:ae64657bc500",
|
|
157
|
+
"bodyClassName": "p-0"
|
|
158
|
+
}
|
|
159
|
+
is_enable: true
|
|
160
|
+
label: 设置选项卡权限
|
|
161
|
+
'on': record_only
|
|
162
|
+
type: amis_button
|
|
163
|
+
visible: !!js/function |
|
|
164
|
+
function (object_name, record_id, record_permissions, data) {
|
|
165
|
+
return data.record.type === 'profile';
|
|
166
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-core-objects",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.104",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"steedos"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/service-package-loader": "3.0.0-beta.
|
|
13
|
+
"@steedos/service-package-loader": "3.0.0-beta.104",
|
|
14
14
|
"json2xls": "^0.1.2",
|
|
15
15
|
"lodash": "^4.17.21"
|
|
16
16
|
},
|
|
17
17
|
"description": "steedos package",
|
|
18
18
|
"repository": {},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "0b5e09432a643b1f1788d024ff67d53f14a7be72"
|
|
21
21
|
}
|
/package/main/default/objects/{permission_set.object.yml → permission_set/permission_set.object.yml}
RENAMED
|
File without changes
|