@tachybase/module-acl 1.5.1 → 1.6.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/externalVersion.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.
|
|
4
|
-
"@tachybase/schema": "1.
|
|
3
|
+
"@tachybase/client": "1.6.1",
|
|
4
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
5
5
|
"antd": "5.22.5",
|
|
6
|
-
"@ant-design/icons": "
|
|
6
|
+
"@ant-design/icons": "6.1.0",
|
|
7
7
|
"react-i18next": "16.2.1",
|
|
8
|
-
"@tego/client": "1.
|
|
9
|
-
"@tego/server": "1.
|
|
8
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
9
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
10
10
|
"async-mutex": "0.5.0",
|
|
11
11
|
"lodash": "4.17.21",
|
|
12
|
-
"@tachybase/test": "1.
|
|
12
|
+
"@tachybase/test": "1.6.0-alpha.9",
|
|
13
13
|
"ahooks": "3.9.0"
|
|
14
14
|
};
|
|
@@ -24,7 +24,7 @@ const availableActionResource = {
|
|
|
24
24
|
name: "availableActions",
|
|
25
25
|
actions: {
|
|
26
26
|
async list(ctx, next) {
|
|
27
|
-
const acl = ctx.
|
|
27
|
+
const acl = ctx.tego.acl;
|
|
28
28
|
const availableActions = acl.getAvailableActions();
|
|
29
29
|
ctx.body = Array.from(availableActions.entries()).map(([, { name, options }]) => {
|
|
30
30
|
return {
|
|
@@ -43,17 +43,17 @@ async function checkAction(ctx, next) {
|
|
|
43
43
|
name: "anonymous"
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
let role = ctx.
|
|
46
|
+
let role = ctx.tego.acl.getRole(currentRole);
|
|
47
47
|
if (!role) {
|
|
48
|
-
await ctx.
|
|
49
|
-
role = ctx.
|
|
48
|
+
await ctx.tego.emitAsync("acl:writeRoleToACL", roleInstance);
|
|
49
|
+
role = ctx.tego.acl.getRole(currentRole);
|
|
50
50
|
}
|
|
51
|
-
const availableActions = ctx.
|
|
51
|
+
const availableActions = ctx.tego.acl.getAvailableActions();
|
|
52
52
|
ctx.body = {
|
|
53
53
|
...role.toJSON(),
|
|
54
54
|
availableActions: [...availableActions.keys()],
|
|
55
55
|
resources: [...role.resources.keys()],
|
|
56
|
-
actionAlias: map2obj(ctx.
|
|
56
|
+
actionAlias: map2obj(ctx.tego.acl.actionAlias),
|
|
57
57
|
allowAll: currentRole === "root",
|
|
58
58
|
allowConfigure: roleInstance.get("allowConfigure"),
|
|
59
59
|
allowMenuItemIds: roleInstance.get("menuUiSchemas").map((uiSchema) => uiSchema.get("x-uid")),
|
|
@@ -37,12 +37,12 @@ function createWithACLMetaMiddleware() {
|
|
|
37
37
|
var _a, _b, _c;
|
|
38
38
|
await next();
|
|
39
39
|
const dataSourceKey = ctx.get("x-data-source");
|
|
40
|
-
const dataSource = ctx.
|
|
40
|
+
const dataSource = ctx.tego.dataSourceManager.dataSources.get(dataSourceKey);
|
|
41
41
|
const db = dataSource ? dataSource.collectionManager.db : ctx.db;
|
|
42
42
|
if (!db) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const acl = dataSource ? dataSource.acl : ctx.
|
|
45
|
+
const acl = dataSource ? dataSource.acl : ctx.tego.acl;
|
|
46
46
|
if (!ctx.action || !ctx.get("X-With-ACL-Meta") || ctx.status !== 200) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
package/dist/server/server.js
CHANGED
|
@@ -582,7 +582,6 @@ class PluginACL extends import_server.Plugin {
|
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
async load() {
|
|
585
|
-
await this.importCollections((0, import_node_path.resolve)(__dirname, "collections"));
|
|
586
585
|
this.db.extendCollection({
|
|
587
586
|
name: "rolesUischemas",
|
|
588
587
|
dumpRules: "required",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-acl",
|
|
3
3
|
"displayName": "Access control",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
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
6
|
"keywords": [
|
|
7
7
|
"Users & permissions"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"main": "./dist/server/index.js",
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@ant-design/icons": "^
|
|
14
|
-
"@tachybase/schema": "1.
|
|
15
|
-
"@tachybase/test": "1.
|
|
16
|
-
"@tego/client": "1.
|
|
17
|
-
"@tego/server": "1.
|
|
13
|
+
"@ant-design/icons": "^6.1.0",
|
|
14
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
15
|
+
"@tachybase/test": "1.6.0-alpha.9",
|
|
16
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
17
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
18
18
|
"@types/jsonwebtoken": "^8.5.9",
|
|
19
19
|
"ahooks": "^3.9.0",
|
|
20
20
|
"antd": "5.22.5",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"react": "18.3.1",
|
|
25
25
|
"react-dom": "18.3.1",
|
|
26
26
|
"react-i18next": "16.2.1",
|
|
27
|
-
"@tachybase/client": "1.
|
|
27
|
+
"@tachybase/client": "1.6.1"
|
|
28
28
|
},
|
|
29
29
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
30
30
|
"displayName.zh-CN": "权限控制",
|