@nocobase/plugin-data-source-manager 1.7.0-beta.8 → 1.7.0-beta.9

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,27 +8,27 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.7.0-beta.8",
11
+ "@nocobase/client": "1.7.0-beta.9",
12
12
  "react": "18.2.0",
13
- "@nocobase/plugin-acl": "1.7.0-beta.8",
14
- "@nocobase/utils": "1.7.0-beta.8",
15
- "@nocobase/server": "1.7.0-beta.8",
16
- "@nocobase/data-source-manager": "1.7.0-beta.8",
13
+ "@nocobase/plugin-acl": "1.7.0-beta.9",
14
+ "@nocobase/utils": "1.7.0-beta.9",
15
+ "@nocobase/server": "1.7.0-beta.9",
16
+ "@nocobase/data-source-manager": "1.7.0-beta.9",
17
17
  "lodash": "4.17.21",
18
+ "@nocobase/acl": "1.7.0-beta.9",
18
19
  "@ant-design/icons": "5.6.1",
19
- "antd": "5.12.8",
20
+ "antd": "5.24.2",
20
21
  "react-router-dom": "6.28.1",
21
22
  "@formily/shared": "2.3.2",
22
23
  "react-i18next": "11.18.6",
23
24
  "@formily/react": "2.3.0",
24
25
  "@emotion/css": "11.13.0",
25
- "@nocobase/database": "1.7.0-beta.8",
26
- "@nocobase/acl": "1.7.0-beta.8",
26
+ "@nocobase/database": "1.7.0-beta.9",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/test": "1.7.0-beta.8",
29
- "@formily/antd-v5": "1.1.9",
28
+ "@nocobase/test": "1.7.0-beta.9",
29
+ "@formily/antd-v5": "1.2.3",
30
30
  "@formily/core": "2.3.0",
31
31
  "@formily/reactive": "2.3.0",
32
- "@dnd-kit/core": "6.1.0",
32
+ "@dnd-kit/core": "5.0.3",
33
33
  "antd-style": "3.7.1"
34
34
  };
@@ -130,7 +130,8 @@ class DataSourceModel extends import_database.Model {
130
130
  acl.setAvailableAction(actionName, actionParams);
131
131
  }
132
132
  acl.allow("*", "*", (ctx) => {
133
- return ctx.state.currentRole === "root";
133
+ var _a;
134
+ return (_a = ctx.state.currentRoles) == null ? void 0 : _a.includes("root");
134
135
  });
135
136
  dataSource.resourceManager.use(import_plugin_acl.setCurrentRole, { tag: "setCurrentRole", before: "acl", after: "auth" });
136
137
  await this.loadIntoACL({ app, acl, transaction: options.transaction });
@@ -54,6 +54,7 @@ var import_connections_roles_resources = require("./models/connections-roles-res
54
54
  var import_connections_roles_resources_action = require("./models/connections-roles-resources-action");
55
55
  var import_data_source = require("./models/data-source");
56
56
  var import_data_sources_roles_model = require("./models/data-sources-roles-model");
57
+ var import_acl = require("@nocobase/acl");
57
58
  const canRefreshStatus = ["loaded", "loading-failed", "reloading-failed"];
58
59
  class PluginDataSourceManagerServer extends import_server.Plugin {
59
60
  dataSourceErrors = {};
@@ -593,7 +594,7 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
593
594
  await next();
594
595
  const { resourceName, actionName } = action.params;
595
596
  if (resourceName === "roles" && actionName == "check") {
596
- const roleName = ctx.state.currentRole;
597
+ const roleNames = ctx.state.currentRoles;
597
598
  const dataSources = await ctx.db.getRepository("dataSources").find();
598
599
  ctx.bodyMeta = {
599
600
  dataSources: dataSources.reduce((carry, dataSourceModel) => {
@@ -606,18 +607,8 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
606
607
  return carry;
607
608
  }
608
609
  const aclInstance = dataSource.acl;
609
- const roleInstance = aclInstance.getRole(roleName);
610
- const dataObj = {
611
- strategy: {},
612
- resources: roleInstance ? [...roleInstance.resources.keys()] : [],
613
- actions: {}
614
- };
615
- if (roleInstance) {
616
- const data = roleInstance.toJSON();
617
- dataObj["name"] = data["name"];
618
- dataObj["strategy"] = data["strategy"];
619
- dataObj["actions"] = data["actions"];
620
- }
610
+ const roleInstances = aclInstance.getRoles(roleNames);
611
+ const dataObj = (0, import_acl.mergeRole)(roleInstances);
621
612
  carry[dataSourceModel.get("key")] = dataObj;
622
613
  return carry;
623
614
  }, {})
@@ -1,9 +1 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
1
  export declare function mergeOptions(fieldOptions: any, modelOptions: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-source-manager",
3
- "version": "1.7.0-beta.8",
3
+ "version": "1.7.0-beta.9",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Data source manager",
6
6
  "displayName.zh-CN": "数据源管理",
@@ -17,5 +17,5 @@
17
17
  "keywords": [
18
18
  "Data model tools"
19
19
  ],
20
- "gitHead": "9ad35ee90db98d95dfa660645d155f4f4e81b47c"
20
+ "gitHead": "7013a5080f3695d7750ab21005c90d2172c16480"
21
21
  }