updating group membership on user deletion

until now groups had members without useraccount after the account has been deleted.

fixes: #5
This commit is contained in:
2020-11-27 17:32:41 +01:00
committed by dietrich
parent e9fbbd91ce
commit 80a41fc1a2
4 changed files with 104 additions and 37 deletions
+11 -2
View File
@@ -18,7 +18,7 @@ fn test_delete_user_function() {
let mf = umanux::Files {
passwd: Some(p.path.clone()),
shadow: Some(s.path),
group: Some(g.path),
group: Some(g.path.clone()),
};
let mut db = umanux::UserDBLocal::load_files(mf).unwrap();
@@ -34,11 +34,20 @@ fn test_delete_user_function() {
assert_eq!(user_res.unwrap().get_username().unwrap(), "teste");
let pflines = pf.lines();
let pflines2 = pf2.lines();
for (l1, l2) in pflines.zip(pflines2) {
for (l1, l2) in pflines.zip(pflines2.clone()) {
if l1 != l2 {
assert!(l1.starts_with("teste"));
assert!(l2.starts_with("bergfried"));
break;
}
}
for line in pflines2 {
assert!(!line.starts_with("teste"))
}
let gf2 = fs::read_to_string(&g.path).unwrap();
let gflines2 = gf2.lines();
for line in gflines2 {
println!("{}", &line);
assert!(!line.ends_with("teste"))
}
}