Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 98 additions & 1 deletion rust/userborn/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/userborn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ xcrypt = "0.3.1"
[dev-dependencies]
indoc = "2.0.6"
expect-test = "1.5.1"
tempfile = "3.8.1"

[profile.release]
opt-level = "s"
Expand Down
8 changes: 4 additions & 4 deletions rust/userborn/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{fs::File, io::Read, path::Path};
use anyhow::{Context, Result};
use serde::Deserialize;

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone, PartialEq, serde::Serialize)]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serde is not used if I see that correctly.

Suggested change
#[derive(Deserialize, Debug, Clone, PartialEq, serde::Serialize)]
#[derive(Deserialize, Debug, Clone, PartialEq)]

#[serde(rename_all = "camelCase")]
pub struct User {
/// Whether the user is a "normal" or a "system" user
Expand All @@ -28,7 +28,7 @@ pub struct User {
pub password: Password,
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone, PartialEq, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Password {
pub password: Option<String>,
Expand All @@ -38,7 +38,7 @@ pub struct Password {
pub initial_hashed_password: Option<String>,
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone, PartialEq, serde::Serialize)]
pub struct Group {
/// Whether the group is a "normal" or a "system" group
#[serde(default)]
Expand All @@ -52,7 +52,7 @@ pub struct Group {
pub members: BTreeSet<String>,
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone, PartialEq, serde::Serialize)]
pub struct Config {
#[serde(default)]
pub users: Vec<User>,
Expand Down
4 changes: 4 additions & 0 deletions rust/userborn/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ impl Entry {
pub fn name(&self) -> &str {
&self.name
}

pub fn user_list(&self) -> &BTreeSet<String> {
&self.user_list
}
}

/// Split a string containing group members separated by `,` into a list.
Expand Down
Loading