Samba sometimes mixes uids and gids for some reason. To improve the usability, if it is not a uid, gids are checked as well and shown when available.

This commit is contained in:
Fabian Stamm 2024-08-19 00:02:17 +02:00
parent 3c44286570
commit 9e763a91ef

View File

@ -220,13 +220,25 @@ impl ACLEditor {
.iter() .iter()
.find(|user| user.uid == uid) .find(|user| user.uid == uid)
.map(|user| user.name.clone()) .map(|user| user.name.clone())
.unwrap_or_else(|| format!("Unknown user {}", uid)), .unwrap_or_else(|| {
self.available_groups
.iter()
.find(|group| group.gid == uid)
.map(|group| format!("({})", group.name))
.unwrap_or_else(|| format!("Unknown user {}", uid))
}),
Qualifier::Group(gid) => self Qualifier::Group(gid) => self
.available_groups .available_groups
.iter() .iter()
.find(|group| group.gid == gid) .find(|group| group.gid == gid)
.map(|group| group.name.clone()) .map(|group| group.name.clone())
.unwrap_or_else(|| format!("Unknown group {}", gid)), .unwrap_or_else(|| {
self.available_users
.iter()
.find(|user| user.uid == gid)
.map(|user| format!("({})", user.name))
.unwrap_or_else(|| format!("Unknown group {}", gid))
}),
Qualifier::Other => "Other".to_string(), Qualifier::Other => "Other".to_string(),
Qualifier::GroupObj => "GroupObj".to_string(), Qualifier::GroupObj => "GroupObj".to_string(),
Qualifier::UserObj => "UserObj".to_string(), Qualifier::UserObj => "UserObj".to_string(),