mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
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:
parent
ce0d9d2bed
commit
1979eb8a9c
|
@ -1,5 +1,5 @@
|
||||||
import * as Db from '@/Db';
|
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 { In } from 'typeorm';
|
||||||
import { BaseCommand } from '../BaseCommand';
|
import { BaseCommand } from '../BaseCommand';
|
||||||
|
|
||||||
|
@ -17,6 +17,11 @@ export class Reset extends BaseCommand {
|
||||||
await AuthIdentity.delete({ providerType: 'ldap' });
|
await AuthIdentity.delete({ providerType: 'ldap' });
|
||||||
await User.delete({ id: In(ldapIdentities.map((i) => i.userId)) });
|
await User.delete({ id: In(ldapIdentities.map((i) => i.userId)) });
|
||||||
await Settings.delete({ key: LDAP_FEATURE_NAME });
|
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.');
|
this.logger.info('Successfully reset the database to default ldap state.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,13 +326,13 @@ export class Start extends BaseCommand {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await handleLdapInit();
|
||||||
|
|
||||||
await Server.start();
|
await Server.start();
|
||||||
|
|
||||||
// Start to get active workflows and run their triggers
|
// Start to get active workflows and run their triggers
|
||||||
await this.activeWorkflowRunner.init();
|
await this.activeWorkflowRunner.init();
|
||||||
|
|
||||||
await handleLdapInit();
|
|
||||||
|
|
||||||
const editorUrl = GenericHelpers.getBaseUrl();
|
const editorUrl = GenericHelpers.getBaseUrl();
|
||||||
this.log(`\nEditor is now accessible via:\n${editorUrl}`);
|
this.log(`\nEditor is now accessible via:\n${editorUrl}`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue