@nocobase/plugin-acl 2.1.0-beta.1 → 2.1.0-beta.11

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,8 +11,13 @@ import { Plugin } from '@nocobase/server';
11
11
  import { RoleModel } from './model/RoleModel';
12
12
  import { RoleResourceActionModel } from './model/RoleResourceActionModel';
13
13
  import { RoleResourceModel } from './model/RoleResourceModel';
14
+ import { SanitizeAssociationValuesOptions } from './middlewares/check-change-with-association';
15
+ import type { ACL } from '@nocobase/acl';
14
16
  export declare class PluginACLServer extends Plugin {
15
- get acl(): import("@nocobase/acl").ACL;
17
+ get acl(): ACL;
18
+ sanitizeAssociationValues(options: SanitizeAssociationValuesOptions & {
19
+ acl?: ACL;
20
+ }): Promise<any>;
16
21
  writeResourceToACL(resourceModel: RoleResourceModel, transaction: Transaction): Promise<void>;
17
22
  writeActionToACL(actionModel: RoleResourceActionModel, transaction: Transaction): Promise<void>;
18
23
  handleSyncMessage(message: any): Promise<void>;
@@ -61,6 +61,12 @@ class PluginACLServer extends import_server.Plugin {
61
61
  get acl() {
62
62
  return this.app.acl;
63
63
  }
64
+ async sanitizeAssociationValues(options) {
65
+ return (0, import_check_change_with_association.sanitizeAssociationValues)({
66
+ ...options,
67
+ acl: options.acl ?? this.acl
68
+ });
69
+ }
64
70
  async writeResourceToACL(resourceModel, transaction) {
65
71
  await resourceModel.writeToACL({
66
72
  acl: this.acl,
@@ -505,7 +511,6 @@ class PluginACLServer extends import_server.Plugin {
505
511
  }
506
512
  return next();
507
513
  });
508
- const parseJsonTemplate = this.app.acl.parseJsonTemplate;
509
514
  this.app.acl.beforeGrantAction(async (ctx) => {
510
515
  const actionName = this.app.acl.resolveActionAlias(ctx.actionName);
511
516
  if (import_lodash.default.isPlainObject(ctx.params)) {
package/package.json CHANGED
@@ -6,8 +6,8 @@
6
6
  "description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
7
7
  "description.ru-RU": "На основе ролей, ресурсов и действий система контроля доступа может точно управлять разрешениями на изменение интерфейса, работу с данными, доступ к меню и разрешениями для подключаемых модулей.",
8
8
  "description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
9
- "version": "2.1.0-beta.1",
10
- "license": "AGPL-3.0",
9
+ "version": "2.1.0-beta.11",
10
+ "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/acl",
13
13
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/acl",
@@ -44,5 +44,5 @@
44
44
  "url": "git+https://github.com/nocobase/nocobase.git",
45
45
  "directory": "packages/plugins/acl"
46
46
  },
47
- "gitHead": "de3efeb357b6a98b813f1c14831afa832aed1780"
47
+ "gitHead": "b02e78b928f476d848b88bc545d3acddca00fe3c"
48
48
  }