feat: Start implementing roles (and domainless service users)
This commit is contained in:
parent
8c29f1d31f
commit
10548295cd
10 changed files with 156 additions and 21 deletions
25
src/main.rs
25
src/main.rs
|
|
@ -12,18 +12,39 @@ mod stream;
|
|||
#[cfg(feature = "http")]
|
||||
use crate::http::http_listen;
|
||||
use cli::CliArgs;
|
||||
use db::{Database, DatabaseInterface, MemoryDatabase, User};
|
||||
use db::{Database, DatabaseInterface, MemoryDatabase, Role, User};
|
||||
use error::GlobalError;
|
||||
use ldap::ldap_handler;
|
||||
use listener::ListenerPath;
|
||||
|
||||
async fn create_dummy_users<D: DatabaseInterface>(db: &mut Database<D>) {
|
||||
db.create_user(User {
|
||||
username: "admin".to_string(),
|
||||
domain: None,
|
||||
password: "adminadmin".to_string(),
|
||||
mail: "TODO".to_string(),
|
||||
role: Role::Admin,
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
for domain in &["a", "b", "c"] {
|
||||
db.create_user(User {
|
||||
username: domain.to_string(),
|
||||
domain: format!("{domain}.localhost"),
|
||||
domain: Some(format!("{domain}.localhost")),
|
||||
password: "adminadmin".to_string(),
|
||||
mail: format!("{domain}@{domain}.localhost"),
|
||||
role: Role::DomainAdmin(format!("{domain}.localhost")),
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
db.create_user(User {
|
||||
username: domain.to_string(),
|
||||
domain: Some(format!("user{domain}.localhost")),
|
||||
password: "adminadmin".to_string(),
|
||||
mail: format!("user{domain}@{domain}.localhost"),
|
||||
role: Role::User,
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
|
|
|
|||
Loading…
Reference in a new issue