mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-16 12:18:04 +00:00
Start to delete user account
This commit is contained in:
@ -488,6 +488,19 @@ pub fn delete(group_id: &GroupID) -> ResultBoxError {
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Delete all the groups a user belongs to
|
||||
pub fn delete_all_user_groups(user_id: &UserID) -> ResultBoxError {
|
||||
for group_id in &get_list_user(user_id, false)? {
|
||||
if is_last_admin(group_id, user_id)? {
|
||||
delete(group_id)?;
|
||||
} else {
|
||||
delete_member(group_id, user_id)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
/// Turn a database entry into a group struct
|
||||
fn db_to_group(row: &database::RowResult) -> ResultBoxError<Group> {
|
||||
|
Reference in New Issue
Block a user