@nocobase/plugin-acl 1.7.0-beta.10 → 1.7.0-beta.12

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.
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.7.0-beta.10",
11
+ "@nocobase/client": "1.7.0-beta.12",
12
12
  "antd": "5.24.2",
13
13
  "react": "18.2.0",
14
14
  "react-i18next": "11.18.6",
@@ -16,15 +16,15 @@ module.exports = {
16
16
  "ahooks": "3.7.8",
17
17
  "@formily/react": "2.3.0",
18
18
  "@ant-design/icons": "5.6.1",
19
- "@nocobase/utils": "1.7.0-beta.10",
20
- "@nocobase/actions": "1.7.0-beta.10",
21
- "@nocobase/cache": "1.7.0-beta.10",
22
- "@nocobase/database": "1.7.0-beta.10",
23
- "@nocobase/server": "1.7.0-beta.10",
19
+ "@nocobase/utils": "1.7.0-beta.12",
20
+ "@nocobase/actions": "1.7.0-beta.12",
21
+ "@nocobase/cache": "1.7.0-beta.12",
22
+ "@nocobase/database": "1.7.0-beta.12",
23
+ "@nocobase/server": "1.7.0-beta.12",
24
24
  "lodash": "4.17.21",
25
- "@nocobase/test": "1.7.0-beta.10",
25
+ "@nocobase/test": "1.7.0-beta.12",
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.7.0-beta.10"
29
+ "@nocobase/acl": "1.7.0-beta.12"
30
30
  };
@@ -33,7 +33,7 @@ var import_constants = require("../constants");
33
33
  var import_enum = require("../enum");
34
34
  async function setCurrentRole(ctx, next) {
35
35
  var _a, _b;
36
- const currentRole = ctx.get("X-Role");
36
+ let currentRole = ctx.get("X-Role");
37
37
  if (currentRole === "anonymous") {
38
38
  ctx.state.currentRole = currentRole;
39
39
  return next();
@@ -64,7 +64,8 @@ async function setCurrentRole(ctx, next) {
64
64
  ctx.state.currentUser.roles = userRoles;
65
65
  const systemSettings = await ctx.db.getRepository("systemSettings").findOne();
66
66
  const roleMode = (systemSettings == null ? void 0 : systemSettings.get("roleMode")) || import_enum.SystemRoleMode.default;
67
- if (ctx.state.currentRole === import_constants.UNION_ROLE_KEY && roleMode === import_enum.SystemRoleMode.default) {
67
+ if ([currentRole, ctx.state.currentRole].includes(import_constants.UNION_ROLE_KEY) && roleMode === import_enum.SystemRoleMode.default) {
68
+ currentRole = userRoles[0].name;
68
69
  ctx.state.currentRole = userRoles[0].name;
69
70
  ctx.headers["x-role"] = userRoles[0].name;
70
71
  } else if (roleMode === import_enum.SystemRoleMode.onlyUseUnion) {
@@ -99,7 +100,7 @@ async function setCurrentRole(ctx, next) {
99
100
  var _a2;
100
101
  return (_a2 = role2 == null ? void 0 : role2.rolesUsers) == null ? void 0 : _a2.default;
101
102
  });
102
- role = (_b = defaultRole || userRoles[0]) == null ? void 0 : _b.name;
103
+ role = (_b = defaultRole || userRoles.find((x) => x.name !== import_constants.UNION_ROLE_KEY)) == null ? void 0 : _b.name;
103
104
  }
104
105
  ctx.state.currentRole = role;
105
106
  ctx.state.currentRoles = [role];
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.7.0-beta.10",
7
+ "version": "1.7.0-beta.12",
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": "e9077cd02774330e9d9d0c9ff0324596207d90a0"
36
+ "gitHead": "db80012c1561bd9391cd83b5aef57fd79445da8e"
37
37
  }