@nocobase/plugin-acl 1.0.0-alpha.10 → 1.0.0-alpha.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,24 +8,24 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.0.0-alpha.10",
11
+ "@nocobase/client": "1.0.0-alpha.12",
12
12
  "react": "18.2.0",
13
13
  "@formily/shared": "2.3.0",
14
14
  "antd": "5.12.8",
15
15
  "@formily/react": "2.3.0",
16
16
  "@ant-design/icons": "5.2.6",
17
17
  "react-i18next": "11.18.6",
18
- "@nocobase/utils": "1.0.0-alpha.10",
19
- "@nocobase/actions": "1.0.0-alpha.10",
20
- "@nocobase/cache": "1.0.0-alpha.10",
21
- "@nocobase/database": "1.0.0-alpha.10",
22
- "@nocobase/server": "1.0.0-alpha.10",
18
+ "@nocobase/utils": "1.0.0-alpha.12",
19
+ "@nocobase/actions": "1.0.0-alpha.12",
20
+ "@nocobase/cache": "1.0.0-alpha.12",
21
+ "@nocobase/database": "1.0.0-alpha.12",
22
+ "@nocobase/server": "1.0.0-alpha.12",
23
23
  "async-mutex": "0.3.2",
24
24
  "lodash": "4.17.21",
25
- "@nocobase/test": "1.0.0-alpha.10",
25
+ "@nocobase/test": "1.0.0-alpha.12",
26
26
  "@formily/core": "2.3.0",
27
27
  "ahooks": "3.7.8",
28
28
  "@formily/antd-v5": "1.1.9",
29
29
  "antd-style": "3.4.5",
30
- "@nocobase/acl": "1.0.0-alpha.10"
30
+ "@nocobase/acl": "1.0.0-alpha.12"
31
31
  };
@@ -41,8 +41,7 @@ __export(with_acl_meta_exports, {
41
41
  module.exports = __toCommonJS(with_acl_meta_exports);
42
42
  var import_lodash = __toESM(require("lodash"));
43
43
  var import_database = require("@nocobase/database");
44
- class NoPermissionError extends Error {
45
- }
44
+ var import_acl = require("@nocobase/acl");
46
45
  function createWithACLMetaMiddleware() {
47
46
  return async (ctx, next) => {
48
47
  var _a, _b, _c, _d;
@@ -119,13 +118,13 @@ function createWithACLMetaMiddleware() {
119
118
  },
120
119
  permission: {},
121
120
  throw(...args) {
122
- throw new NoPermissionError(...args);
121
+ throw new import_acl.NoPermissionError(...args);
123
122
  }
124
123
  };
125
124
  try {
126
125
  await acl.getActionParams(actionCtx);
127
126
  } catch (e) {
128
- if (e instanceof NoPermissionError) {
127
+ if (e instanceof import_acl.NoPermissionError) {
129
128
  continue;
130
129
  }
131
130
  throw e;
@@ -123,7 +123,9 @@ class PluginACLServer extends import_server.Plugin {
123
123
  "dataSources.roles:*",
124
124
  "dataSources:list",
125
125
  "roles.dataSourcesCollections:*",
126
- "roles.dataSourceResources:*"
126
+ "roles.dataSourceResources:*",
127
+ "dataSourcesRolesResourcesScopes:*",
128
+ "rolesResourcesScopes:*"
127
129
  ]
128
130
  });
129
131
  this.app.acl.beforeGrantAction((ctx) => {
@@ -514,6 +516,19 @@ class PluginACLServer extends import_server.Plugin {
514
516
  },
515
517
  { after: "dataSource", group: "with-acl-meta" }
516
518
  );
519
+ this.db.on("afterUpdateCollection", async (collection) => {
520
+ if (collection.options.loadedFromCollectionManager) {
521
+ this.app.acl.appendStrategyResource(collection.name);
522
+ }
523
+ });
524
+ this.db.on("afterDefineCollection", async (collection) => {
525
+ if (collection.options.loadedFromCollectionManager) {
526
+ this.app.acl.appendStrategyResource(collection.name);
527
+ }
528
+ });
529
+ this.db.on("afterRemoveCollection", (collection) => {
530
+ this.app.acl.removeStrategyResource(collection.name);
531
+ });
517
532
  }
518
533
  async install() {
519
534
  const repo = this.db.getRepository("collections");
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.0.0-alpha.10",
7
+ "version": "1.0.0-alpha.12",
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": "39c634c88f835f8eadedf72ca11a9fb3323a50f8"
37
+ "gitHead": "d8db7d708cf8e7819003dbbe636238164bc5ec5b"
38
38
  }