33 lines
860 B
Rust
33 lines
860 B
Rust
use serde::{Deserialize, Serialize};
|
|
use std::collections::BTreeMap;
|
|
|
|
#[derive(thiserror::Error, Clone, Debug)]
|
|
pub enum Error {
|
|
#[error("user {0} not found in any group")]
|
|
UserNotFound(String),
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
|
|
pub struct Acl {
|
|
pub acls: Vec<Rule>,
|
|
pub groups: BTreeMap<String, Vec<String>>,
|
|
#[serde(rename = "tagowners")]
|
|
pub tag_owners: BTreeMap<String, Vec<String>>,
|
|
pub hosts: BTreeMap<String, String>,
|
|
pub tests: Vec<Test>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
|
|
pub struct Rule {
|
|
pub action: String,
|
|
pub users: Vec<String>,
|
|
pub ports: Vec<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
|
|
pub struct Test {
|
|
pub users: Vec<String>,
|
|
pub allow: Option<Vec<String>>,
|
|
pub deny: Option<Vec<String>>,
|
|
}
|