Skip to content

Commit 4b98181

Browse files
update remove user logic
1 parent d3227ef commit 4b98181

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/rbac/user.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,13 @@ impl UserGroup {
317317
if users.is_empty() {
318318
return Ok(());
319319
}
320-
let old_users = &self.users;
321320
let new_users = HashSet::from_iter(self.users.difference(&users).cloned());
322-
323-
if old_users.eq(&new_users) {
321+
let removed_users: HashSet<String> = self.users.intersection(&users).cloned().collect();
322+
if removed_users.is_empty() {
324323
return Ok(());
325324
}
326325
// also refresh all user sessions
327-
for username in &users {
326+
for username in &removed_users {
328327
mut_sessions().remove_user(username);
329328
}
330329
self.users.clone_from(&new_users);

0 commit comments

Comments
 (0)