@nocobase/plugin-acl 1.4.0-alpha → 1.4.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.
@@ -11,21 +11,21 @@ module.exports = {
11
11
  "antd": "5.12.8",
12
12
  "react": "18.2.0",
13
13
  "react-i18next": "11.18.6",
14
- "@nocobase/client": "1.4.0-alpha",
15
- "@formily/shared": "2.3.0",
14
+ "@nocobase/client": "1.4.0-alpha.1",
15
+ "@formily/shared": "2.3.2",
16
16
  "@formily/react": "2.3.0",
17
17
  "@ant-design/icons": "5.2.6",
18
- "@nocobase/utils": "1.4.0-alpha",
19
- "@nocobase/actions": "1.4.0-alpha",
20
- "@nocobase/cache": "1.4.0-alpha",
21
- "@nocobase/database": "1.4.0-alpha",
22
- "@nocobase/server": "1.4.0-alpha",
18
+ "@nocobase/utils": "1.4.0-alpha.1",
19
+ "@nocobase/actions": "1.4.0-alpha.1",
20
+ "@nocobase/cache": "1.4.0-alpha.1",
21
+ "@nocobase/database": "1.4.0-alpha.1",
22
+ "@nocobase/server": "1.4.0-alpha.1",
23
23
  "async-mutex": "0.3.2",
24
24
  "lodash": "4.17.21",
25
- "@nocobase/test": "1.4.0-alpha",
25
+ "@nocobase/test": "1.4.0-alpha.1",
26
26
  "@formily/core": "2.3.0",
27
27
  "ahooks": "3.7.8",
28
28
  "@formily/antd-v5": "1.1.9",
29
- "antd-style": "3.4.5",
30
- "@nocobase/acl": "1.4.0-alpha"
29
+ "antd-style": "3.7.1",
30
+ "@nocobase/acl": "1.4.0-alpha.1"
31
31
  };
@@ -65,6 +65,9 @@ function createWithACLMetaMiddleware() {
65
65
  return;
66
66
  }
67
67
  const Model = collection.model;
68
+ if (collection.isMultiFilterTargetKey()) {
69
+ return;
70
+ }
68
71
  const primaryKeyField = Model.primaryKeyField || Model.primaryKeyAttribute;
69
72
  let listData;
70
73
  if ((_a = ctx.body) == null ? void 0 : _a.data) {
@@ -143,6 +146,9 @@ function createWithACLMetaMiddleware() {
143
146
  }
144
147
  return listData.map((item) => item[primaryKeyField]);
145
148
  })();
149
+ if (ids.filter(Boolean).length == 0) {
150
+ return;
151
+ }
146
152
  const conditions = [];
147
153
  const allAllowed = [];
148
154
  for (const [action, params, actionCtx] of actionsParams) {
@@ -414,11 +414,11 @@ class PluginACLServer extends import_server.Plugin {
414
414
  }
415
415
  };
416
416
  });
417
- this.app.resourcer.use(async (ctx, next) => {
417
+ this.app.resourceManager.use(async function showAnonymous(ctx, next) {
418
418
  const { actionName, resourceName, params } = ctx.action;
419
- const { showAnonymous } = params || {};
419
+ const { showAnonymous: showAnonymous2 } = params || {};
420
420
  if (actionName === "list" && resourceName === "roles") {
421
- if (!showAnonymous) {
421
+ if (!showAnonymous2) {
422
422
  ctx.action.mergeParams({
423
423
  filter: {
424
424
  "name.$ne": "anonymous"
@@ -492,6 +492,13 @@ class PluginACLServer extends import_server.Plugin {
492
492
  await next();
493
493
  return;
494
494
  }
495
+ const hasFilterByTk = (params) => {
496
+ return JSON.stringify(params).includes("filterByTk");
497
+ };
498
+ if (!hasFilterByTk(ctx.permission.mergedParams) || !hasFilterByTk(ctx.permission.rawParams)) {
499
+ await next();
500
+ return;
501
+ }
495
502
  const filteredCount = await repository.count(ctx.permission.mergedParams);
496
503
  const queryCount = await repository.count(ctx.permission.rawParams);
497
504
  if (queryCount > filteredCount) {
@@ -508,7 +515,7 @@ class PluginACLServer extends import_server.Plugin {
508
515
  );
509
516
  const withACLMeta = (0, import_with_acl_meta.createWithACLMetaMiddleware)();
510
517
  this.app.use(
511
- async (ctx, next) => {
518
+ async function withACLMetaMiddleware(ctx, next) {
512
519
  try {
513
520
  await withACLMeta(ctx, next);
514
521
  } catch (error) {
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.4.0-alpha",
7
+ "version": "1.4.0-alpha.1",
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": "f097a2bddec152522b5645bd5d451f4c866d2060"
37
+ "gitHead": "b42379db55cd8774d3543c8d6cdc566434d3f170"
38
38
  }