@nocobase/plugin-acl 1.9.0-beta.8 → 1.9.0
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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.9.0
|
|
11
|
+
"@nocobase/client": "1.9.0",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-i18next": "11.18.6",
|
|
@@ -17,14 +17,14 @@ module.exports = {
|
|
|
17
17
|
"@formily/react": "2.3.0",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"@nocobase/utils": "1.9.0
|
|
21
|
-
"@nocobase/actions": "1.9.0
|
|
22
|
-
"@nocobase/cache": "1.9.0
|
|
23
|
-
"@nocobase/database": "1.9.0
|
|
24
|
-
"@nocobase/server": "1.9.0
|
|
25
|
-
"@nocobase/test": "1.9.0
|
|
20
|
+
"@nocobase/utils": "1.9.0",
|
|
21
|
+
"@nocobase/actions": "1.9.0",
|
|
22
|
+
"@nocobase/cache": "1.9.0",
|
|
23
|
+
"@nocobase/database": "1.9.0",
|
|
24
|
+
"@nocobase/server": "1.9.0",
|
|
25
|
+
"@nocobase/test": "1.9.0",
|
|
26
26
|
"@formily/core": "2.3.0",
|
|
27
27
|
"@formily/antd-v5": "1.2.3",
|
|
28
28
|
"antd-style": "3.7.1",
|
|
29
|
-
"@nocobase/acl": "1.9.0
|
|
29
|
+
"@nocobase/acl": "1.9.0"
|
|
30
30
|
};
|
|
@@ -29,6 +29,7 @@ __export(user_setDefaultRole_exports, {
|
|
|
29
29
|
setDefaultRole: () => setDefaultRole
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(user_setDefaultRole_exports);
|
|
32
|
+
var import_constants = require("../constants");
|
|
32
33
|
async function setDefaultRole(ctx, next) {
|
|
33
34
|
const {
|
|
34
35
|
values: { roleName }
|
|
@@ -72,7 +73,7 @@ async function setDefaultRole(ctx, next) {
|
|
|
72
73
|
if (targetUserRole) {
|
|
73
74
|
await repository.model.update({ default: true }, { where: { userId: currentUser.id, roleName }, transaction });
|
|
74
75
|
model = targetUserRole.set("default", true);
|
|
75
|
-
} else {
|
|
76
|
+
} else if (roleName === import_constants.UNION_ROLE_KEY) {
|
|
76
77
|
model = await repository.create({
|
|
77
78
|
values: {
|
|
78
79
|
userId: currentUser.id,
|
|
@@ -82,7 +83,9 @@ async function setDefaultRole(ctx, next) {
|
|
|
82
83
|
transaction
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
if (model) {
|
|
87
|
+
db.emitAsync("rolesUsers.afterSave", model);
|
|
88
|
+
}
|
|
86
89
|
});
|
|
87
90
|
ctx.body = "ok";
|
|
88
91
|
await next();
|
package/dist/server/server.js
CHANGED
|
@@ -344,6 +344,7 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
346
|
const User = this.db.getCollection("users");
|
|
347
|
+
const user = await User.repository.findOne();
|
|
347
348
|
await User.repository.update({
|
|
348
349
|
values: {
|
|
349
350
|
roles: ["root", "admin", "member"]
|
|
@@ -353,7 +354,7 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
353
354
|
const RolesUsers = this.db.getCollection("rolesUsers");
|
|
354
355
|
await RolesUsers.repository.update({
|
|
355
356
|
filter: {
|
|
356
|
-
userId:
|
|
357
|
+
userId: user.id,
|
|
357
358
|
roleName: "root"
|
|
358
359
|
},
|
|
359
360
|
values: {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "权限控制",
|
|
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
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
7
|
-
"version": "1.9.0
|
|
7
|
+
"version": "1.9.0",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
34
34
|
"directory": "packages/plugins/acl"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "d92ce9096c2b3b5a8f205ecc0e1dedd64d7ee48b"
|
|
37
37
|
}
|