mirror of
https://github.com/nocobase/nocobase
synced 2024-11-17 00:16:30 +00:00
chore: load dataSource after start
This commit is contained in:
parent
ec52a82ff0
commit
c7c0208c4a
@ -162,28 +162,26 @@ export class PluginDataSourceManagerServer extends Plugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.app.on('afterStart', async (app: Application) => {
|
this.app.on('afterStart', async (app: Application) => {
|
||||||
const databaseConnections: DatabaseConnectionModel[] = await this.app.db
|
const dataSourcesRecords: DataSourceModel[] = await this.app.db.getRepository('dataSources').find();
|
||||||
.getRepository('databaseConnections')
|
for (const dataSourceRecord of dataSourcesRecords) {
|
||||||
.find();
|
await dataSourceRecord.loadIntoApplication({
|
||||||
|
|
||||||
// load all connections
|
|
||||||
for (const databaseConnection of databaseConnections) {
|
|
||||||
await databaseConnection.loadIntoApplication({
|
|
||||||
app,
|
app,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.app.on('afterStart', async (app: Application) => {
|
||||||
// load roles
|
// load roles
|
||||||
const rolesModel: ConnectionsRolesModel[] = await this.app.db.getRepository('connectionsRoles').find();
|
// const rolesModel: ConnectionsRolesModel[] = await this.app.db.getRepository('connectionsRoles').find();
|
||||||
const pluginACL: any = this.app.pm.get('acl');
|
// const pluginACL: any = this.app.pm.get('acl');
|
||||||
|
//
|
||||||
for (const roleModel of rolesModel) {
|
// for (const roleModel of rolesModel) {
|
||||||
await roleModel.writeToAcl({
|
// await roleModel.writeToAcl({
|
||||||
grantHelper: pluginACL.grantHelper,
|
// grantHelper: pluginACL.grantHelper,
|
||||||
associationFieldsActions: pluginACL.associationFieldsActions,
|
// associationFieldsActions: pluginACL.associationFieldsActions,
|
||||||
acl: this.app.acls.get(roleModel.get('connectionName')),
|
// acl: this.app.acls.get(roleModel.get('connectionName')),
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
this.app.db.on('connectionsRolesResources.afterSaveWithAssociations', async (model, options) => {
|
this.app.db.on('connectionsRolesResources.afterSaveWithAssociations', async (model, options) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user