@nocobase/plugin-acl 0.11.0-alpha.1 → 0.11.1-alpha.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.
|
@@ -37,7 +37,8 @@ var _default = {
|
|
|
37
37
|
type: 'string',
|
|
38
38
|
title: '{{t("Role name")}}',
|
|
39
39
|
'x-component': 'Input'
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
translation: true
|
|
41
42
|
}, {
|
|
42
43
|
type: 'boolean',
|
|
43
44
|
name: 'default'
|
|
@@ -76,6 +77,16 @@ var _default = {
|
|
|
76
77
|
type: 'set',
|
|
77
78
|
name: 'snippets',
|
|
78
79
|
defaultValue: ['!ui.*', '!pm', '!pm.*']
|
|
80
|
+
}, {
|
|
81
|
+
type: 'belongsToMany',
|
|
82
|
+
name: 'users',
|
|
83
|
+
target: 'users',
|
|
84
|
+
foreignKey: 'roleName',
|
|
85
|
+
otherKey: 'userId',
|
|
86
|
+
onDelete: 'CASCADE',
|
|
87
|
+
sourceKey: 'name',
|
|
88
|
+
targetKey: 'id',
|
|
89
|
+
through: 'rolesUsers'
|
|
79
90
|
}]
|
|
80
91
|
};
|
|
81
92
|
exports.default = _default;
|
|
@@ -53,7 +53,7 @@ class RoleResourceActionModel extends _database().Model {
|
|
|
53
53
|
const field = _step.value;
|
|
54
54
|
const collectionField = collection.getField(field);
|
|
55
55
|
if (!collectionField) {
|
|
56
|
-
console.log(
|
|
56
|
+
console.log(`field ${field} does not exist at ${collection.name}`);
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
const fieldType = collectionField.get('type');
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "权限控制",
|
|
5
5
|
"description": "A simple access control based on roles, resources and actions",
|
|
6
6
|
"description.zh-CN": "基于角色、资源和操作的权限控制。",
|
|
7
|
-
"version": "0.11.
|
|
7
|
+
"version": "0.11.1-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./lib/server/index.js",
|
|
10
10
|
"files": [
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"client.d.ts"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@nocobase/acl": "0.11.
|
|
23
|
-
"@nocobase/actions": "0.11.
|
|
24
|
-
"@nocobase/client": "0.11.
|
|
25
|
-
"@nocobase/database": "0.11.
|
|
26
|
-
"@nocobase/server": "0.11.
|
|
27
|
-
"@nocobase/test": "0.11.
|
|
28
|
-
"@nocobase/utils": "0.11.
|
|
22
|
+
"@nocobase/acl": "0.11.1-alpha.1",
|
|
23
|
+
"@nocobase/actions": "0.11.1-alpha.1",
|
|
24
|
+
"@nocobase/client": "0.11.1-alpha.1",
|
|
25
|
+
"@nocobase/database": "0.11.1-alpha.1",
|
|
26
|
+
"@nocobase/server": "0.11.1-alpha.1",
|
|
27
|
+
"@nocobase/test": "0.11.1-alpha.1",
|
|
28
|
+
"@nocobase/utils": "0.11.1-alpha.1",
|
|
29
29
|
"@types/jsonwebtoken": "^8.5.8",
|
|
30
30
|
"jsonwebtoken": "^8.5.1",
|
|
31
31
|
"react": "^18.2.0",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
37
37
|
"directory": "packages/plugins/acl"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "9ed1dba520bc5f3a7cb1255ea8d92ccbefc11bc8"
|
|
40
40
|
}
|
|
@@ -36,6 +36,7 @@ export default {
|
|
|
36
36
|
title: '{{t("Role name")}}',
|
|
37
37
|
'x-component': 'Input',
|
|
38
38
|
},
|
|
39
|
+
translation: true,
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
42
|
type: 'boolean',
|
|
@@ -85,5 +86,16 @@ export default {
|
|
|
85
86
|
name: 'snippets',
|
|
86
87
|
defaultValue: ['!ui.*', '!pm', '!pm.*'],
|
|
87
88
|
},
|
|
89
|
+
{
|
|
90
|
+
type: 'belongsToMany',
|
|
91
|
+
name: 'users',
|
|
92
|
+
target: 'users',
|
|
93
|
+
foreignKey: 'roleName',
|
|
94
|
+
otherKey: 'userId',
|
|
95
|
+
onDelete: 'CASCADE',
|
|
96
|
+
sourceKey: 'name',
|
|
97
|
+
targetKey: 'id',
|
|
98
|
+
through: 'rolesUsers',
|
|
99
|
+
},
|
|
88
100
|
],
|
|
89
101
|
} as CollectionOptions;
|
|
@@ -46,7 +46,7 @@ export class RoleResourceActionModel extends Model {
|
|
|
46
46
|
const collectionField = collection.getField(field);
|
|
47
47
|
|
|
48
48
|
if (!collectionField) {
|
|
49
|
-
console.log(
|
|
49
|
+
console.log(`field ${field} does not exist at ${collection.name}`);
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
52
|
|