mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 18:46:17 +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) => {
|
||||
const databaseConnections: DatabaseConnectionModel[] = await this.app.db
|
||||
.getRepository('databaseConnections')
|
||||
.find();
|
||||
|
||||
// load all connections
|
||||
for (const databaseConnection of databaseConnections) {
|
||||
await databaseConnection.loadIntoApplication({
|
||||
const dataSourcesRecords: DataSourceModel[] = await this.app.db.getRepository('dataSources').find();
|
||||
for (const dataSourceRecord of dataSourcesRecords) {
|
||||
await dataSourceRecord.loadIntoApplication({
|
||||
app,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.app.on('afterStart', async (app: Application) => {
|
||||
// load roles
|
||||
const rolesModel: ConnectionsRolesModel[] = await this.app.db.getRepository('connectionsRoles').find();
|
||||
const pluginACL: any = this.app.pm.get('acl');
|
||||
|
||||
for (const roleModel of rolesModel) {
|
||||
await roleModel.writeToAcl({
|
||||
grantHelper: pluginACL.grantHelper,
|
||||
associationFieldsActions: pluginACL.associationFieldsActions,
|
||||
acl: this.app.acls.get(roleModel.get('connectionName')),
|
||||
});
|
||||
}
|
||||
// const rolesModel: ConnectionsRolesModel[] = await this.app.db.getRepository('connectionsRoles').find();
|
||||
// const pluginACL: any = this.app.pm.get('acl');
|
||||
//
|
||||
// for (const roleModel of rolesModel) {
|
||||
// await roleModel.writeToAcl({
|
||||
// grantHelper: pluginACL.grantHelper,
|
||||
// associationFieldsActions: pluginACL.associationFieldsActions,
|
||||
// acl: this.app.acls.get(roleModel.get('connectionName')),
|
||||
// });
|
||||
// }
|
||||
});
|
||||
|
||||
this.app.db.on('connectionsRolesResources.afterSaveWithAssociations', async (model, options) => {
|
||||
|
Loading…
Reference in New Issue
Block a user