@tachybase/module-acl 0.23.8
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/.turbo/turbo-build.log +14 -0
- package/LICENSE +201 -0
- package/README.md +11 -0
- package/README.zh-CN.md +11 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/NewRole.d.ts +2 -0
- package/dist/client/RolesManagement.d.ts +2 -0
- package/dist/client/RolesManagerProvider.d.ts +4 -0
- package/dist/client/RolesMenu.d.ts +7 -0
- package/dist/client/hooks/load-more-observer.d.ts +7 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.js +9 -0
- package/dist/client/locale.d.ts +1 -0
- package/dist/client/permissions/ActionPermissions.d.ts +4 -0
- package/dist/client/permissions/AvailableActions.d.ts +3 -0
- package/dist/client/permissions/GeneralPermissions.d.ts +4 -0
- package/dist/client/permissions/MenuItemsProvider.d.ts +4 -0
- package/dist/client/permissions/MenuPermissions.d.ts +4 -0
- package/dist/client/permissions/Permissions.d.ts +4 -0
- package/dist/client/permissions/PluginPermissions.d.ts +4 -0
- package/dist/client/permissions/RolesResourcesActions.d.ts +3 -0
- package/dist/client/permissions/ScopeSelect.d.ts +3 -0
- package/dist/client/permissions/StrategyActions.d.ts +2 -0
- package/dist/client/permissions/style.d.ts +1 -0
- package/dist/client/roles-manager.d.ts +10 -0
- package/dist/client/schemas/roles.d.ts +55 -0
- package/dist/client/schemas/scopes.d.ts +11 -0
- package/dist/externalVersion.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +6 -0
- package/dist/locale/ko_KR.json +4 -0
- package/dist/locale/zh-CN.json +11 -0
- package/dist/server/actions/available-actions.d.ts +7 -0
- package/dist/server/actions/available-actions.js +42 -0
- package/dist/server/actions/role-check.d.ts +1 -0
- package/dist/server/actions/role-check.js +67 -0
- package/dist/server/actions/role-collections.d.ts +7 -0
- package/dist/server/actions/role-collections.js +75 -0
- package/dist/server/actions/user-setDefaultRole.d.ts +2 -0
- package/dist/server/actions/user-setDefaultRole.js +65 -0
- package/dist/server/collections/roles-users.d.ts +2 -0
- package/dist/server/collections/roles-users.js +30 -0
- package/dist/server/collections/roles.d.ts +2 -0
- package/dist/server/collections/roles.js +119 -0
- package/dist/server/collections/rolesResources.d.ts +2 -0
- package/dist/server/collections/rolesResources.js +55 -0
- package/dist/server/collections/rolesResourcesActions.d.ts +2 -0
- package/dist/server/collections/rolesResourcesActions.js +51 -0
- package/dist/server/collections/rolesResourcesScopes.d.ts +2 -0
- package/dist/server/collections/rolesResourcesScopes.js +45 -0
- package/dist/server/collections/users.d.ts +2 -0
- package/dist/server/collections/users.js +52 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +50 -0
- package/dist/server/middlewares/setCurrentRole.d.ts +2 -0
- package/dist/server/middlewares/setCurrentRole.js +74 -0
- package/dist/server/middlewares/with-acl-meta.d.ts +2 -0
- package/dist/server/middlewares/with-acl-meta.js +242 -0
- package/dist/server/migrations/20221214072638-set-role-snippets.d.ts +6 -0
- package/dist/server/migrations/20221214072638-set-role-snippets.js +43 -0
- package/dist/server/model/RoleModel.d.ts +8 -0
- package/dist/server/model/RoleModel.js +46 -0
- package/dist/server/model/RoleResourceActionModel.d.ts +12 -0
- package/dist/server/model/RoleResourceActionModel.js +85 -0
- package/dist/server/model/RoleResourceModel.d.ts +18 -0
- package/dist/server/model/RoleResourceModel.js +79 -0
- package/dist/server/server.d.ts +34 -0
- package/dist/server/server.js +648 -0
- package/dist/swagger/index.d.ts +366 -0
- package/dist/swagger/index.js +395 -0
- package/package.json +40 -0
- package/server.d.ts +3 -0
- package/server.js +1 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var swagger_exports = {};
|
|
19
|
+
__export(swagger_exports, {
|
|
20
|
+
default: () => swagger_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(swagger_exports);
|
|
23
|
+
var swagger_default = {
|
|
24
|
+
openapi: "3.0.2",
|
|
25
|
+
info: {
|
|
26
|
+
title: "TachyBase API - ACL plugin"
|
|
27
|
+
},
|
|
28
|
+
paths: {
|
|
29
|
+
"/roles:list": {
|
|
30
|
+
get: {
|
|
31
|
+
tags: ["roles"],
|
|
32
|
+
description: "",
|
|
33
|
+
parameters: [],
|
|
34
|
+
responses: {
|
|
35
|
+
200: {
|
|
36
|
+
description: "ok",
|
|
37
|
+
content: {
|
|
38
|
+
"application/json": {
|
|
39
|
+
schema: {
|
|
40
|
+
type: "array",
|
|
41
|
+
items: {
|
|
42
|
+
$ref: "#/components/schemas/role"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"/roles:get": {
|
|
52
|
+
get: {
|
|
53
|
+
tags: ["roles"],
|
|
54
|
+
description: "",
|
|
55
|
+
parameters: [
|
|
56
|
+
{
|
|
57
|
+
name: "filterByTk",
|
|
58
|
+
in: "query",
|
|
59
|
+
description: "role name",
|
|
60
|
+
required: true,
|
|
61
|
+
schema: {
|
|
62
|
+
type: "string"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
responses: {
|
|
67
|
+
200: {
|
|
68
|
+
description: "ok",
|
|
69
|
+
content: {
|
|
70
|
+
"application/json": {
|
|
71
|
+
schema: {
|
|
72
|
+
$ref: "#/components/schemas/role"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"/roles:create": {
|
|
81
|
+
post: {
|
|
82
|
+
tags: ["roles"],
|
|
83
|
+
description: "",
|
|
84
|
+
requestBody: {
|
|
85
|
+
content: {
|
|
86
|
+
"application/json": {
|
|
87
|
+
schema: {
|
|
88
|
+
$ref: "#/components/schemas/role"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
responses: {
|
|
94
|
+
"200": {
|
|
95
|
+
description: "OK",
|
|
96
|
+
content: {
|
|
97
|
+
"application/json": {
|
|
98
|
+
schema: {
|
|
99
|
+
$ref: "#/components/schemas/role"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"/roles:update": {
|
|
108
|
+
post: {
|
|
109
|
+
tags: ["roles"],
|
|
110
|
+
description: "",
|
|
111
|
+
parameters: [
|
|
112
|
+
{
|
|
113
|
+
name: "filterByTk",
|
|
114
|
+
in: "query",
|
|
115
|
+
description: "role name",
|
|
116
|
+
required: true,
|
|
117
|
+
schema: {
|
|
118
|
+
type: "string"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
requestBody: {
|
|
123
|
+
content: {
|
|
124
|
+
"application/json": {
|
|
125
|
+
schema: {
|
|
126
|
+
$ref: "#/components/schemas/role"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
responses: {
|
|
132
|
+
200: {
|
|
133
|
+
description: "ok",
|
|
134
|
+
content: {
|
|
135
|
+
"application/json": {
|
|
136
|
+
schema: {
|
|
137
|
+
$ref: "#/components/schemas/role"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"/roles:destroy": {
|
|
146
|
+
post: {
|
|
147
|
+
tags: ["roles"],
|
|
148
|
+
description: "",
|
|
149
|
+
parameters: [
|
|
150
|
+
{
|
|
151
|
+
name: "filterByTk",
|
|
152
|
+
in: "query",
|
|
153
|
+
description: "role name",
|
|
154
|
+
required: true,
|
|
155
|
+
schema: {
|
|
156
|
+
type: "string"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
responses: {
|
|
161
|
+
"200": {
|
|
162
|
+
description: "OK"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"/roles:check": {
|
|
168
|
+
get: {
|
|
169
|
+
tags: ["roles"],
|
|
170
|
+
description: "return current user role",
|
|
171
|
+
responses: {
|
|
172
|
+
200: {
|
|
173
|
+
description: "ok",
|
|
174
|
+
content: {
|
|
175
|
+
"application/json": {
|
|
176
|
+
schema: {
|
|
177
|
+
$ref: "#/components/schemas/role"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"/roles:setDefaultRole": {
|
|
186
|
+
post: {
|
|
187
|
+
tags: ["roles"],
|
|
188
|
+
description: "set default role for new user",
|
|
189
|
+
requestBody: {
|
|
190
|
+
content: {
|
|
191
|
+
"application/json": {
|
|
192
|
+
schema: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
roleName: {
|
|
196
|
+
type: "string"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
responses: {
|
|
204
|
+
"200": {
|
|
205
|
+
description: "OK"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"/roles/{roleName}/collections:list": {
|
|
211
|
+
get: {
|
|
212
|
+
tags: ["roles.collections"],
|
|
213
|
+
description: "list permissions of collections for role by roleName",
|
|
214
|
+
parameters: [
|
|
215
|
+
{
|
|
216
|
+
name: "filterByTk",
|
|
217
|
+
in: "query",
|
|
218
|
+
description: "role name",
|
|
219
|
+
required: true,
|
|
220
|
+
schema: {
|
|
221
|
+
type: "string"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
responses: {
|
|
226
|
+
"200": {
|
|
227
|
+
description: "OK",
|
|
228
|
+
content: {
|
|
229
|
+
"application/json": {
|
|
230
|
+
schema: {
|
|
231
|
+
type: "array",
|
|
232
|
+
items: {
|
|
233
|
+
type: "object",
|
|
234
|
+
properties: {
|
|
235
|
+
type: {
|
|
236
|
+
type: "string",
|
|
237
|
+
description: "collection"
|
|
238
|
+
},
|
|
239
|
+
name: {
|
|
240
|
+
type: "string",
|
|
241
|
+
description: "collection name"
|
|
242
|
+
},
|
|
243
|
+
collectionName: {
|
|
244
|
+
type: "string",
|
|
245
|
+
description: "collection name"
|
|
246
|
+
},
|
|
247
|
+
title: {
|
|
248
|
+
type: "string",
|
|
249
|
+
description: "collection title"
|
|
250
|
+
},
|
|
251
|
+
roleName: {
|
|
252
|
+
type: "string",
|
|
253
|
+
description: "role name"
|
|
254
|
+
},
|
|
255
|
+
usingConfig: {
|
|
256
|
+
type: "string",
|
|
257
|
+
enum: ["resourceAction", "strategy"],
|
|
258
|
+
description: "resourceAction: \u5355\u72EC\u914D\u7F6E, strategy: \u5168\u5C40\u7B56\u7565"
|
|
259
|
+
},
|
|
260
|
+
exists: {
|
|
261
|
+
type: "boolean",
|
|
262
|
+
description: "\u662F\u5426\u5B58\u5728\u5355\u72EC\u914D\u7F6E\u7684\u6743\u9650"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"/availableActions:list": {
|
|
274
|
+
get: {
|
|
275
|
+
tags: ["availableActions"],
|
|
276
|
+
description: "available actions of resource in current system",
|
|
277
|
+
parameters: [],
|
|
278
|
+
responses: {
|
|
279
|
+
"200": {
|
|
280
|
+
description: "OK",
|
|
281
|
+
content: {
|
|
282
|
+
"application/json": {
|
|
283
|
+
schema: {
|
|
284
|
+
type: "array",
|
|
285
|
+
items: {
|
|
286
|
+
type: "object",
|
|
287
|
+
properties: {
|
|
288
|
+
name: {
|
|
289
|
+
type: "string",
|
|
290
|
+
description: "Action\u540D\u79F0"
|
|
291
|
+
},
|
|
292
|
+
displayName: {
|
|
293
|
+
type: "string",
|
|
294
|
+
description: "Action\u663E\u793A\u540D\u79F0"
|
|
295
|
+
},
|
|
296
|
+
allowConfigureFields: {
|
|
297
|
+
type: "boolean",
|
|
298
|
+
description: "\u662F\u5426\u5141\u8BB8\u914D\u7F6E\u5B57\u6BB5"
|
|
299
|
+
},
|
|
300
|
+
onNewRecord: {
|
|
301
|
+
type: "string",
|
|
302
|
+
description: "\u662F\u5426\u662F\u65B0\u8BB0\u5F55\u7684Action"
|
|
303
|
+
},
|
|
304
|
+
type: {
|
|
305
|
+
type: "string",
|
|
306
|
+
description: "new-data \u6216\u8005 old-data"
|
|
307
|
+
},
|
|
308
|
+
aliases: {
|
|
309
|
+
type: "array",
|
|
310
|
+
items: {
|
|
311
|
+
type: "string"
|
|
312
|
+
},
|
|
313
|
+
description: "\u522B\u540D"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
components: {
|
|
326
|
+
schemas: {
|
|
327
|
+
role: {
|
|
328
|
+
type: "object",
|
|
329
|
+
properties: {
|
|
330
|
+
title: {
|
|
331
|
+
type: "string",
|
|
332
|
+
description: "\u89D2\u8272\u540D\u79F0"
|
|
333
|
+
},
|
|
334
|
+
name: {
|
|
335
|
+
type: "string",
|
|
336
|
+
description: "\u89D2\u8272\u6807\u8BC6"
|
|
337
|
+
},
|
|
338
|
+
description: {
|
|
339
|
+
type: "string",
|
|
340
|
+
description: "\u89D2\u8272\u63CF\u8FF0"
|
|
341
|
+
},
|
|
342
|
+
hidden: {
|
|
343
|
+
type: "boolean",
|
|
344
|
+
description: "\u662F\u5426\u9690\u85CF"
|
|
345
|
+
},
|
|
346
|
+
default: {
|
|
347
|
+
type: "boolean",
|
|
348
|
+
description: "\u662F\u5426\u9ED8\u8BA4"
|
|
349
|
+
},
|
|
350
|
+
allowConfigure: {
|
|
351
|
+
type: "boolean",
|
|
352
|
+
description: "\u662F\u5426\u5141\u8BB8\u914D\u7F6E"
|
|
353
|
+
},
|
|
354
|
+
allowNewMenu: {
|
|
355
|
+
type: "boolean",
|
|
356
|
+
description: "\u662F\u5426\u5141\u8BB8\u65B0\u5EFA\u83DC\u5355"
|
|
357
|
+
},
|
|
358
|
+
snippets: {
|
|
359
|
+
type: "array",
|
|
360
|
+
items: {
|
|
361
|
+
type: "string"
|
|
362
|
+
},
|
|
363
|
+
description: "\u63A5\u53E3\u6743\u9650"
|
|
364
|
+
},
|
|
365
|
+
strategy: {
|
|
366
|
+
type: "array",
|
|
367
|
+
description: "\u6570\u636E\u8868\u6743\u9650\u7B56\u7565",
|
|
368
|
+
items: {
|
|
369
|
+
type: "object",
|
|
370
|
+
properties: {
|
|
371
|
+
actions: {
|
|
372
|
+
type: "array",
|
|
373
|
+
items: {
|
|
374
|
+
type: "string"
|
|
375
|
+
},
|
|
376
|
+
description: "\u64CD\u4F5C"
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
createdAt: {
|
|
382
|
+
type: "string",
|
|
383
|
+
format: "date-time",
|
|
384
|
+
description: "\u521B\u5EFA\u65F6\u95F4"
|
|
385
|
+
},
|
|
386
|
+
updatedAt: {
|
|
387
|
+
type: "string",
|
|
388
|
+
format: "date-time",
|
|
389
|
+
description: "\u66F4\u65B0\u65F6\u95F4"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/module-acl",
|
|
3
|
+
"displayName": "Access control",
|
|
4
|
+
"version": "0.23.8",
|
|
5
|
+
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"Users & permissions"
|
|
8
|
+
],
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"main": "./dist/server/index.js",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@ant-design/icons": "^5.5.2",
|
|
13
|
+
"@types/jsonwebtoken": "^8.5.9",
|
|
14
|
+
"ahooks": "^3.8.4",
|
|
15
|
+
"antd": "5.22.5",
|
|
16
|
+
"async-mutex": "^0.3.2",
|
|
17
|
+
"jsonwebtoken": "^8.5.1",
|
|
18
|
+
"lodash": "4.17.21",
|
|
19
|
+
"react": "^18.3.1",
|
|
20
|
+
"react-dom": "^18.3.1",
|
|
21
|
+
"react-i18next": "^15.2.0",
|
|
22
|
+
"@tachybase/schema": "0.23.8",
|
|
23
|
+
"@tachybase/components": "0.23.8"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@tachybase/acl": "0.23.8",
|
|
27
|
+
"@tachybase/actions": "0.23.8",
|
|
28
|
+
"@tachybase/client": "0.23.8",
|
|
29
|
+
"@tachybase/cache": "0.23.8",
|
|
30
|
+
"@tachybase/server": "0.23.8",
|
|
31
|
+
"@tachybase/database": "0.23.8",
|
|
32
|
+
"@tachybase/test": "0.23.8",
|
|
33
|
+
"@tachybase/utils": "0.23.8"
|
|
34
|
+
},
|
|
35
|
+
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
36
|
+
"displayName.zh-CN": "权限控制",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tachybase-build --no-dts @tachybase/module-acl"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|