mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor(core): Remove slow LDAP query and unused telemetry event (#7068)
https://linear.app/n8n/issue/PAY-660
This commit is contained in:
parent
b8e06d245f
commit
95cb127dfa
|
@ -963,14 +963,6 @@ export class InternalHooks implements IInternalHooksClass {
|
||||||
return this.telemetry.track('Ldap general sync finished', data);
|
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: {
|
async onUserUpdatedLdapSettings(data: {
|
||||||
user_id: string;
|
user_id: string;
|
||||||
loginIdAttribute: string;
|
loginIdAttribute: string;
|
||||||
|
|
|
@ -104,14 +104,6 @@ export class LdapSync {
|
||||||
role,
|
role,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (usersToDisable.length) {
|
|
||||||
void Container.get(InternalHooks).onLdapUsersDisabled({
|
|
||||||
reason: 'ldap_update',
|
|
||||||
users: usersToDisable.length,
|
|
||||||
user_ids: usersToDisable,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.debug('LDAP - Users processed', {
|
Logger.debug('LDAP - Users processed', {
|
||||||
created: usersToCreate.length,
|
created: usersToCreate.length,
|
||||||
updated: usersToUpdate.length,
|
updated: usersToUpdate.length,
|
||||||
|
|
|
@ -180,11 +180,6 @@ export const updateLdapConfig = async (ldapConfig: LdapConfig): Promise<void> =>
|
||||||
const ldapUsers = await getLdapUsers();
|
const ldapUsers = await getLdapUsers();
|
||||||
if (ldapUsers.length) {
|
if (ldapUsers.length) {
|
||||||
await deleteAllLdapIdentities();
|
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
|
* If it's the first run of this feature, all the default data is created in the database
|
||||||
*/
|
*/
|
||||||
export const handleLdapInit = async (): Promise<void> => {
|
export const handleLdapInit = async (): Promise<void> => {
|
||||||
if (!isLdapEnabled()) {
|
if (!isLdapEnabled()) return;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ldapConfig = await getLdapConfig();
|
const ldapConfig = await getLdapConfig();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue