@nocobase/plugin-data-source-manager
Advanced tools
Comparing version 0.21.0-alpha.15 to 0.21.0-alpha.16
module.exports = { | ||
"@nocobase/client": "0.21.0-alpha.15", | ||
"@nocobase/client": "0.21.0-alpha.16", | ||
"react": "18.2.0", | ||
"@nocobase/server": "0.21.0-alpha.15", | ||
"@nocobase/server": "0.21.0-alpha.16", | ||
"lodash": "4.17.21", | ||
@@ -13,6 +13,6 @@ "@ant-design/icons": "5.2.6", | ||
"@emotion/css": "11.11.2", | ||
"@nocobase/database": "0.21.0-alpha.15", | ||
"@nocobase/utils": "0.21.0-alpha.15", | ||
"@nocobase/plugin-acl": "0.21.0-alpha.15", | ||
"@nocobase/acl": "0.21.0-alpha.15", | ||
"@nocobase/database": "0.21.0-alpha.16", | ||
"@nocobase/utils": "0.21.0-alpha.16", | ||
"@nocobase/plugin-acl": "0.21.0-alpha.16", | ||
"@nocobase/acl": "0.21.0-alpha.16", | ||
"sequelize": "6.35.2", | ||
@@ -19,0 +19,0 @@ "@formily/antd-v5": "1.1.9", |
@@ -25,2 +25,3 @@ var __defProp = Object.defineProperty; | ||
var import_utils = require("@nocobase/utils"); | ||
/* istanbul ignore file -- @preserve */ | ||
class migrate_acl_resources_default extends import_server.Migration { | ||
@@ -27,0 +28,0 @@ on = "afterSync"; |
@@ -66,6 +66,3 @@ var __defProp = Object.defineProperty; | ||
const loadRoleIntoACL = async (model) => { | ||
const pluginACL = app.pm.get("acl"); | ||
await model.writeToAcl({ | ||
grantHelper: pluginACL.grantHelper, | ||
associationFieldsActions: pluginACL.associationFieldsActions, | ||
acl | ||
@@ -97,3 +94,4 @@ }); | ||
...createOptions, | ||
name: this.get("key") | ||
name: dataSourceKey, | ||
logger: app.logger.child({ dataSourceKey }) | ||
}); | ||
@@ -100,0 +98,0 @@ if (loadAtAfterStart) { |
@@ -8,5 +8,3 @@ import { Model } from '@nocobase/database'; | ||
transaction?: Transaction; | ||
associationFieldsActions: any; | ||
grantHelper: any; | ||
}): Promise<void>; | ||
} |
@@ -47,5 +47,3 @@ var __defProp = Object.defineProperty; | ||
acl, | ||
transaction, | ||
grantHelper: options.grantHelper, | ||
associationFieldsActions: options.associationFieldsActions | ||
transaction | ||
}); | ||
@@ -52,0 +50,0 @@ } |
@@ -306,27 +306,27 @@ var __create = Object.create; | ||
}); | ||
this.app.db.on("dataSourcesRolesResources.afterSaveWithAssociations", async (model, options) => { | ||
const { transaction } = options; | ||
const pluginACL = this.app.pm.get("acl"); | ||
const dataSource = this.app.dataSourceManager.dataSources.get(model.get("dataSourceKey")); | ||
await model.writeToACL({ | ||
acl: dataSource.acl, | ||
associationFieldsActions: pluginACL.associationFieldsActions, | ||
transaction, | ||
grantHelper: pluginACL.grantHelper | ||
}); | ||
}); | ||
this.app.db.on("dataSourcesRolesResourcesActions.afterUpdateWithAssociations", async (model, options) => { | ||
const { transaction } = options; | ||
const resource = await model.getResource({ | ||
transaction | ||
}); | ||
const pluginACL = this.app.pm.get("acl"); | ||
const dataSource = this.app.dataSourceManager.dataSources.get(resource.get("dataSourceKey")); | ||
await resource.writeToACL({ | ||
acl: dataSource.acl, | ||
associationFieldsActions: pluginACL.associationFieldsActions, | ||
transaction, | ||
grantHelper: pluginACL.grantHelper | ||
}); | ||
}); | ||
this.app.db.on( | ||
"dataSourcesRolesResources.afterSaveWithAssociations", | ||
async (model, options) => { | ||
const { transaction } = options; | ||
const dataSource = this.app.dataSourceManager.dataSources.get(model.get("dataSourceKey")); | ||
await model.writeToACL({ | ||
acl: dataSource.acl, | ||
transaction | ||
}); | ||
} | ||
); | ||
this.app.db.on( | ||
"dataSourcesRolesResourcesActions.afterUpdateWithAssociations", | ||
async (model, options) => { | ||
const { transaction } = options; | ||
const resource = await model.getResource({ | ||
transaction | ||
}); | ||
const dataSource = this.app.dataSourceManager.dataSources.get(resource.get("dataSourceKey")); | ||
await resource.writeToACL({ | ||
acl: dataSource.acl, | ||
transaction | ||
}); | ||
} | ||
); | ||
this.app.db.on("dataSourcesRolesResources.afterDestroy", async (model, options) => { | ||
@@ -342,7 +342,4 @@ const dataSource = this.app.dataSourceManager.dataSources.get(model.get("dataSourceKey")); | ||
const { transaction } = options; | ||
const pluginACL = this.app.pm.get("acl"); | ||
const dataSource = this.app.dataSourceManager.dataSources.get(model.get("dataSourceKey")); | ||
await model.writeToAcl({ | ||
grantHelper: pluginACL.grantHelper, | ||
associationFieldsActions: pluginACL.associationFieldsActions, | ||
acl: dataSource.acl, | ||
@@ -364,3 +361,2 @@ transaction | ||
const dataSource = this.app.dataSourceManager.dataSources.get("main"); | ||
const pluginACL = this.app.pm.get("acl"); | ||
const dataSourceRole = await this.app.db.getRepository("dataSourcesRoles").findOne({ | ||
@@ -374,4 +370,2 @@ filter: { | ||
await dataSourceRole.writeToAcl({ | ||
grantHelper: pluginACL.grantHelper, | ||
associationFieldsActions: pluginACL.associationFieldsActions, | ||
acl: dataSource.acl, | ||
@@ -378,0 +372,0 @@ transaction |
@@ -23,2 +23,3 @@ var __defProp = Object.defineProperty; | ||
module.exports = __toCommonJS(type_interface_map_exports); | ||
/* istanbul ignore file -- @preserve */ | ||
const typeInterfaceMap = { | ||
@@ -25,0 +26,0 @@ array: "", |
{ | ||
"name": "@nocobase/plugin-data-source-manager", | ||
"version": "0.21.0-alpha.15", | ||
"version": "0.21.0-alpha.16", | ||
"main": "dist/server/index.js", | ||
@@ -19,3 +19,3 @@ "displayName": "Data source manager", | ||
], | ||
"gitHead": "155a252452eba37d8047d7f4a1c3fb518679abf0" | ||
"gitHead": "2914500f14e4454cc5702a49371230865660ca33" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
239175
116
3636