fix(core): Fix issues with LDAP reset and LDAP init (no-changelog) (#5657)

* fix(core): Ldap reset should recreate the default config

* fix(core): init ldap before registering the routes for it
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-03-09 16:24:44 +01:00 committed by GitHub
parent ce0d9d2bed
commit 1979eb8a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import * as Db from '@/Db';
import { LDAP_FEATURE_NAME } from '@/Ldap/constants';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/Ldap/constants';
import { In } from 'typeorm';
import { BaseCommand } from '../BaseCommand';
@ -17,6 +17,11 @@ export class Reset extends BaseCommand {
await AuthIdentity.delete({ providerType: 'ldap' });
await User.delete({ id: In(ldapIdentities.map((i) => i.userId)) });
await Settings.delete({ key: LDAP_FEATURE_NAME });
await Settings.insert({
key: LDAP_FEATURE_NAME,
value: JSON.stringify(LDAP_DEFAULT_CONFIGURATION),
loadOnStartup: true,
});
this.logger.info('Successfully reset the database to default ldap state.');
}

View file

@ -326,13 +326,13 @@ export class Start extends BaseCommand {
);
}
await handleLdapInit();
await Server.start();
// Start to get active workflows and run their triggers
await this.activeWorkflowRunner.init();
await handleLdapInit();
const editorUrl = GenericHelpers.getBaseUrl();
this.log(`\nEditor is now accessible via:\n${editorUrl}`);