diff --git a/packages/plugins/acl/src/server.ts b/packages/plugins/acl/src/server.ts index 7b19c0e12..8a487a06f 100644 --- a/packages/plugins/acl/src/server.ts +++ b/packages/plugins/acl/src/server.ts @@ -269,7 +269,11 @@ export class PluginACL extends Plugin { // sync database role data to acl this.app.on('afterLoad', async (app, options) => { - if (options.method !== 'install') { + if (options.method === 'install') { + return; + } + const exists = await this.app.db.collectionExistsInDb('roles'); + if (exists) { await this.writeRolesToACL(); } }); @@ -443,7 +447,6 @@ export class PluginACL extends Plugin { directory: resolve(__dirname, 'collections'), }); } - } export default PluginACL;