diff --git a/src/core/protocol/server_responses.rs b/src/core/protocol/server_responses.rs index c3fc061..7e9125c 100644 --- a/src/core/protocol/server_responses.rs +++ b/src/core/protocol/server_responses.rs @@ -75,11 +75,13 @@ impl OwnerValidationError { pub fn to_error_message(self, name: &str, db_or_user: DbOrUser) -> String { let user = UnixUser::from_enviroment(); - let UnixUser { username, groups } = user.unwrap_or(UnixUser { + let UnixUser { username, mut groups } = user.unwrap_or(UnixUser { username: "???".to_string(), groups: vec![], }); + groups.sort(); + match self { OwnerValidationError::NoMatch => format!( indoc! {r#" @@ -97,9 +99,9 @@ impl OwnerValidationError { db_or_user.lowercased(), username, groups - .iter() + .into_iter() + .filter(|g| g != &username) .map(|g| format!(" - {}", g)) - .sorted() .join("\n"), ) .to_owned(),