@nocobase/plugin-acl 0.17.0-alpha.6 → 0.18.0-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.
package/dist/externalVersion.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.
|
|
3
|
-
"@nocobase/acl": "0.
|
|
4
|
-
"@nocobase/actions": "0.
|
|
5
|
-
"@nocobase/database": "0.
|
|
6
|
-
"@nocobase/server": "0.
|
|
2
|
+
"@nocobase/client": "0.18.0-alpha.1",
|
|
3
|
+
"@nocobase/acl": "0.18.0-alpha.1",
|
|
4
|
+
"@nocobase/actions": "0.18.0-alpha.1",
|
|
5
|
+
"@nocobase/database": "0.18.0-alpha.1",
|
|
6
|
+
"@nocobase/server": "0.18.0-alpha.1",
|
|
7
7
|
"async-mutex": "0.3.2",
|
|
8
8
|
"lodash": "4.17.21",
|
|
9
|
-
"@nocobase/cache": "0.
|
|
9
|
+
"@nocobase/cache": "0.18.0-alpha.1"
|
|
10
10
|
};
|
|
@@ -38,6 +38,13 @@ async function setCurrentRole(ctx, next) {
|
|
|
38
38
|
raw: true
|
|
39
39
|
})
|
|
40
40
|
);
|
|
41
|
+
if (!roles.length) {
|
|
42
|
+
ctx.state.currentRole = void 0;
|
|
43
|
+
return ctx.throw(401, {
|
|
44
|
+
code: "USER_HAS_NO_ROLES_ERR",
|
|
45
|
+
message: ctx.t("The current user has no roles. Please try another account.", { ns: "acl" })
|
|
46
|
+
});
|
|
47
|
+
}
|
|
41
48
|
ctx.state.currentUser.roles = roles;
|
|
42
49
|
if (currentRole) {
|
|
43
50
|
ctx.state.currentRole = (_a = roles.find((role) => role.name === currentRole)) == null ? void 0 : _a.name;
|
|
@@ -49,7 +56,10 @@ async function setCurrentRole(ctx, next) {
|
|
|
49
56
|
ctx.state.currentRole = (_b = defaultRole || roles[0]) == null ? void 0 : _b.name;
|
|
50
57
|
}
|
|
51
58
|
if (!ctx.state.currentRole) {
|
|
52
|
-
return ctx.throw(401, {
|
|
59
|
+
return ctx.throw(401, {
|
|
60
|
+
code: "ROLE_NOT_FOUND_ERR",
|
|
61
|
+
message: ctx.t("The user role does not exist. Please try signing in again", { ns: "acl" })
|
|
62
|
+
});
|
|
53
63
|
}
|
|
54
64
|
await next();
|
|
55
65
|
}
|
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.
|
|
7
|
+
"version": "0.18.0-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
30
30
|
"directory": "packages/plugins/acl"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "0f5f1c0a37dc397a9dc4c8eec0c4ec20fd8107b0"
|
|
33
33
|
}
|