mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
feat(cli): add external hooks for when members are added or deleted (#3988)
This commit is contained in:
parent
fc6484ba4d
commit
6be999714f
|
@ -66,7 +66,7 @@ export function meNamespace(this: N8nApp): void {
|
||||||
user_id: req.user.id,
|
user_id: req.user.id,
|
||||||
fields_changed: updatedkeys,
|
fields_changed: updatedkeys,
|
||||||
});
|
});
|
||||||
await this.externalHooks.run('user.profile.update', [currentEmail, req.body]);
|
await this.externalHooks.run('user.profile.update', [currentEmail, sanitizeUser(user)]);
|
||||||
|
|
||||||
return sanitizeUser(user);
|
return sanitizeUser(user);
|
||||||
},
|
},
|
||||||
|
|
|
@ -214,6 +214,8 @@ export function usersNamespace(this: N8nApp): void {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await this.externalHooks.run('user.invited', [usersToSetUp]);
|
||||||
|
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
usersPendingSetup.length > 1
|
usersPendingSetup.length > 1
|
||||||
? `Sent ${usersPendingSetup.length} invite emails successfully`
|
? `Sent ${usersPendingSetup.length} invite emails successfully`
|
||||||
|
@ -363,6 +365,9 @@ export function usersNamespace(this: N8nApp): void {
|
||||||
user_id: invitee.id,
|
user_id: invitee.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await this.externalHooks.run('user.profile.update', [invitee.email, sanitizeUser(invitee)]);
|
||||||
|
await this.externalHooks.run('user.password.update', [invitee.email, invitee.password]);
|
||||||
|
|
||||||
return sanitizeUser(updatedUser);
|
return sanitizeUser(updatedUser);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -478,6 +483,8 @@ export function usersNamespace(this: N8nApp): void {
|
||||||
|
|
||||||
void InternalHooksManager.getInstance().onUserDeletion(req.user.id, telemetryData, false);
|
void InternalHooksManager.getInstance().onUserDeletion(req.user.id, telemetryData, false);
|
||||||
|
|
||||||
|
await this.externalHooks.run('user.deleted', [sanitizeUser(userToDelete)]);
|
||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
@ -98,7 +98,11 @@ export async function initTestServer({
|
||||||
|
|
||||||
if (!endpointGroups) return testServer.app;
|
if (!endpointGroups) return testServer.app;
|
||||||
|
|
||||||
if (endpointGroups.includes('credentials') || endpointGroups.includes('me')) {
|
if (
|
||||||
|
endpointGroups.includes('credentials') ||
|
||||||
|
endpointGroups.includes('me') ||
|
||||||
|
endpointGroups.includes('users')
|
||||||
|
) {
|
||||||
testServer.externalHooks = ExternalHooks();
|
testServer.externalHooks = ExternalHooks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue