diff options
Diffstat (limited to 'crates/common/tedge_users/src/lib.rs')
-rw-r--r-- | crates/common/tedge_users/src/lib.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/common/tedge_users/src/lib.rs b/crates/common/tedge_users/src/lib.rs new file mode 100644 index 00000000..d2065e8f --- /dev/null +++ b/crates/common/tedge_users/src/lib.rs @@ -0,0 +1,29 @@ +#[cfg(unix)] +mod unix; + +#[cfg(unix)] +pub use unix::*; + +#[cfg(not(unix))] +mod windows; + +#[cfg(not(unix))] +pub use windows::*; + +pub const ROOT_USER: &str = "root"; +pub const TEDGE_USER: &str = "tedge"; +pub const TEDGE_AGENT_USER: &str = "tedge-agent"; +pub const BROKER_USER: &str = "mosquitto"; + +#[allow(dead_code)] // These errors are only raised from unix +#[derive(thiserror::Error, Debug)] +pub enum UserSwitchError { + #[error("Tried to become user, but it did not exist: {name}")] + UnknownUser { name: String }, + + #[error("Tried to become group, but it did not exist: {name}")] + UnknownGroup { name: String }, + + #[error(transparent)] + NotAuthorized(#[from] std::io::Error), +} |