✨ back: delete user data administrative endpoint (#799)
This commit is contained in:
committed by
Anton Shepilov
parent
9d35fbe0d7
commit
cb61d4d8d1
@@ -199,7 +199,7 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
|
||||
if (!user) {
|
||||
throw CrudException.notFound(`User ${consoleUserId} doesn't exists`);
|
||||
}
|
||||
await gr.services.companies.removeUserFromCompany({ id: company.id }, { id: user.id });
|
||||
await gr.services.companies.removeUserFromCompany({ id: company.id }, user.id);
|
||||
}
|
||||
|
||||
async removeUser(consoleUserId: string): Promise<void> {
|
||||
@@ -328,6 +328,16 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
|
||||
}
|
||||
}
|
||||
|
||||
async userWasDeletedForceLogout(userId: string) {
|
||||
const sessionRepository = gr.services.console.getSessionRepo();
|
||||
if (!sessionRepository) return;
|
||||
const sessions = (await sessionRepository.find({ sub: userId })).getEntities();
|
||||
for (const session of sessions) {
|
||||
session.revoked_at = new Date().getTime();
|
||||
await sessionRepository.save(session);
|
||||
}
|
||||
}
|
||||
|
||||
async verifyJwtSid(sid: string): Promise<void> {
|
||||
const sessionRepository = gr.services.console.getSessionRepo();
|
||||
if (sid) {
|
||||
|
||||
Reference in New Issue
Block a user