@nocobase/plugin-acl 0.21.0-alpha.1 → 0.21.0-alpha.2

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.
@@ -1,22 +1,22 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.21.0-alpha.1",
2
+ "@nocobase/client": "0.21.0-alpha.2",
3
3
  "react": "18.2.0",
4
4
  "@formily/shared": "2.3.0",
5
5
  "antd": "5.12.8",
6
6
  "@formily/react": "2.3.0",
7
7
  "@ant-design/icons": "5.2.6",
8
8
  "react-i18next": "11.18.6",
9
- "@nocobase/utils": "0.21.0-alpha.1",
10
- "@nocobase/actions": "0.21.0-alpha.1",
11
- "@nocobase/cache": "0.21.0-alpha.1",
12
- "@nocobase/database": "0.21.0-alpha.1",
13
- "@nocobase/server": "0.21.0-alpha.1",
9
+ "@nocobase/utils": "0.21.0-alpha.2",
10
+ "@nocobase/actions": "0.21.0-alpha.2",
11
+ "@nocobase/cache": "0.21.0-alpha.2",
12
+ "@nocobase/database": "0.21.0-alpha.2",
13
+ "@nocobase/server": "0.21.0-alpha.2",
14
14
  "async-mutex": "0.3.2",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/test": "0.21.0-alpha.1",
16
+ "@nocobase/test": "0.21.0-alpha.2",
17
17
  "@formily/core": "2.3.0",
18
18
  "ahooks": "3.7.8",
19
19
  "@formily/antd-v5": "1.1.9",
20
20
  "antd-style": "3.4.5",
21
- "@nocobase/acl": "0.21.0-alpha.1"
21
+ "@nocobase/acl": "0.21.0-alpha.2"
22
22
  };
@@ -35,7 +35,7 @@ var import_acl = require("@nocobase/acl");
35
35
  var import_database = require("@nocobase/database");
36
36
  function createWithACLMetaMiddleware() {
37
37
  return async (ctx, next) => {
38
- var _a, _b, _c;
38
+ var _a, _b, _c, _d;
39
39
  await next();
40
40
  const dataSourceKey = ctx.get("x-data-source");
41
41
  const dataSource = ctx.app.dataSourceManager.dataSources.get(dataSourceKey);
@@ -57,8 +57,17 @@ function createWithACLMetaMiddleware() {
57
57
  }
58
58
  const Model = collection.model;
59
59
  const primaryKeyField = Model.primaryKeyField || Model.primaryKeyAttribute;
60
- const dataPath = ((_a = ctx.body) == null ? void 0 : _a.rows) ? "body.rows" : "body";
61
- let listData = import_lodash.default.get(ctx, dataPath);
60
+ let listData;
61
+ if ((_a = ctx.body) == null ? void 0 : _a.data) {
62
+ listData = ctx.data;
63
+ } else if ((_b = ctx.body) == null ? void 0 : _b.rows) {
64
+ listData = ctx.body.rows;
65
+ } else if (ctx.body) {
66
+ listData = ctx.body;
67
+ }
68
+ if (!listData) {
69
+ return;
70
+ }
62
71
  if (actionName == "get") {
63
72
  listData = import_lodash.default.castArray(listData);
64
73
  }
@@ -112,7 +121,7 @@ function createWithACLMetaMiddleware() {
112
121
  }
113
122
  actionsParams.push([
114
123
  action,
115
- ((_b = actionCtx.permission) == null ? void 0 : _b.can) === null && !actionCtx.permission.skip ? null : ((_c = actionCtx.permission) == null ? void 0 : _c.parsedParams) || {},
124
+ ((_c = actionCtx.permission) == null ? void 0 : _c.can) === null && !actionCtx.permission.skip ? null : ((_d = actionCtx.permission) == null ? void 0 : _d.parsedParams) || {},
116
125
  actionCtx
117
126
  ]);
118
127
  }
@@ -599,7 +599,7 @@ class PluginACL extends import_server.Plugin {
599
599
  ctx.logger.error(error);
600
600
  }
601
601
  },
602
- { after: "restApi", group: "after" }
602
+ { after: "dataSource", group: "with-acl-meta" }
603
603
  );
604
604
  }
605
605
  async install() {
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": "0.21.0-alpha.1",
7
+ "version": "0.21.0-alpha.2",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/acl",
@@ -34,5 +34,5 @@
34
34
  "url": "git+https://github.com/nocobase/nocobase.git",
35
35
  "directory": "packages/plugins/acl"
36
36
  },
37
- "gitHead": "afd2f3d1341b85ea9daa7b2667dd4ace1fafb7ff"
37
+ "gitHead": "90628f2e2da846208fb2d7966ddb4e467d187ffb"
38
38
  }