1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-30 01:06:27 +00:00

Close user websockets when deleting its account

This commit is contained in:
Pierre HUBERT 2021-02-05 13:29:44 +01:00
parent 15f8df2386
commit 5f3eab7c07

View File

@ -1,5 +1,6 @@
use crate::constants::{PASSWORD_RESET_TOKEN_LENGTH, PASSWORD_RESET_TOKEN_LIFETIME}; use crate::constants::{PASSWORD_RESET_TOKEN_LENGTH, PASSWORD_RESET_TOKEN_LIFETIME};
use crate::constants::database_tables_names::{USER_ACCESS_TOKENS_TABLE, USERS_TABLE}; use crate::constants::database_tables_names::{USER_ACCESS_TOKENS_TABLE, USERS_TABLE};
use crate::controllers::user_ws_controller;
use crate::data::account_export::AccountExport; use crate::data::account_export::AccountExport;
use crate::data::api_client::APIClient; use crate::data::api_client::APIClient;
use crate::data::error::{ExecError, ResultBoxError}; use crate::data::error::{ExecError, ResultBoxError};
@ -302,7 +303,8 @@ pub fn export(user_id: &UserID) -> ResultBoxError<AccountExport> {
/// Delete a user's account /// Delete a user's account
pub fn delete(user_id: &UserID) -> ResultBoxError { pub fn delete(user_id: &UserID) -> ResultBoxError {
// TODO : close all websockets of user // Close all WebSockets of user
user_ws_controller::disconnect_user_from_all_sockets(user_id)?;
// Delete all group membership // Delete all group membership
groups_helper::delete_all_user_groups(user_id)?; groups_helper::delete_all_user_groups(user_id)?;