Skip to content

Commit

Permalink
fix(core): Fix issues with LDAP reset and LDAP init (no-changelog) (#…
Browse files Browse the repository at this point in the history
…5657)

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

* fix(core): init ldap before registering the routes for it
  • Loading branch information
netroy authored Mar 9, 2023
1 parent ce0d9d2 commit 1979eb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/cli/src/commands/ldap/reset.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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.');
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down

0 comments on commit 1979eb8

Please sign in to comment.