refactor(core): Remove slow LDAP query and unused telemetry event (#7068)

https://linear.app/n8n/issue/PAY-660
This commit is contained in:
Iván Ovejero 2023-09-01 12:05:14 +02:00 committed by GitHub
parent b8e06d245f
commit 95cb127dfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 32 deletions

View file

@ -963,14 +963,6 @@ export class InternalHooks implements IInternalHooksClass {
return this.telemetry.track('Ldap general sync finished', data);
}
async onLdapUsersDisabled(data: {
reason: 'ldap_update' | 'ldap_feature_deactivated';
users: number;
user_ids: string[];
}): Promise<void> {
return this.telemetry.track('Ldap users disabled', data);
}
async onUserUpdatedLdapSettings(data: {
user_id: string;
loginIdAttribute: string;

View file

@ -104,14 +104,6 @@ export class LdapSync {
role,
);
if (usersToDisable.length) {
void Container.get(InternalHooks).onLdapUsersDisabled({
reason: 'ldap_update',
users: usersToDisable.length,
user_ids: usersToDisable,
});
}
Logger.debug('LDAP - Users processed', {
created: usersToCreate.length,
updated: usersToUpdate.length,

View file

@ -180,11 +180,6 @@ export const updateLdapConfig = async (ldapConfig: LdapConfig): Promise<void> =>
const ldapUsers = await getLdapUsers();
if (ldapUsers.length) {
await deleteAllLdapIdentities();
void Container.get(InternalHooks).onLdapUsersDisabled({
reason: 'ldap_update',
users: ldapUsers.length,
user_ids: ldapUsers.map((user) => user.id),
});
}
}
@ -200,17 +195,7 @@ export const updateLdapConfig = async (ldapConfig: LdapConfig): Promise<void> =>
* If it's the first run of this feature, all the default data is created in the database
*/
export const handleLdapInit = async (): Promise<void> => {
if (!isLdapEnabled()) {
const ldapUsers = await getLdapUsers();
if (ldapUsers.length) {
void Container.get(InternalHooks).onLdapUsersDisabled({
reason: 'ldap_feature_deactivated',
users: ldapUsers.length,
user_ids: ldapUsers.map((user) => user.id),
});
}
return;
}
if (!isLdapEnabled()) return;
const ldapConfig = await getLdapConfig();