) {
+ for domain in &["a", "b", "c"] {
db.create_user(User {
- username: letter.to_string(),
- domain: Some(domain.clone()),
+ username: domain.to_string(),
+ domain: format!("{domain}.localhost"),
password: "adminadmin".to_string(),
- mail: format!("{letter}@{domain}"),
- role: Role::DomainAdmin(domain.clone()),
- })
- .await
- .unwrap()
- .unwrap();
- db.create_user(User {
- username: format!("user{letter}"),
- domain: Some(domain.clone()),
- password: "adminadmin".to_string(),
- mail: format!("user{letter}@{domain}"),
- role: Role::User,
+ mail: format!("{domain}@{domain}.localhost"),
})
.await
.unwrap()
@@ -67,28 +39,13 @@ async fn main() -> Result<(), GlobalError> {
// .init();
// tracing::subscriber::set_global_default(subscriber)?;
- let ldap_listener = ListenerPath::new(&cli.listen_ldap)?.listener().await?;
+ let listener = ListenerPath::new(&cli.listen)?.listener().await?;
- let mut db = if let Some(db_path) = &cli.db {
- FilesystemDatabase::from_path(db_path).await.unwrap()
- } else {
- MemoryDatabase::new()
- };
+ let mut db = MemoryDatabase::new();
create_dummy_users(&mut db).await;
- #[cfg(feature = "http")]
- {
- let http_listener = ListenerPath::new(&cli.listen_http)?.listener().await?;
- let http_db = db.clone();
- tokio::spawn(http_listen(http_listener, http_db));
- }
-
- // If the connection is None, it's because the client aborted early
- // so there's nothing to do about it.
- while let Some(stream) = ldap_listener.accept_ldap().await? {
- let db = db.clone();
- tokio::spawn(ldap_handler(stream, db));
- }
+ let ldap_db = db.clone();
+ tokio::spawn(ldap_listen(listener, ldap_db));
Ok(())
}
diff --git a/templates/base.html b/templates/base.html
deleted file mode 100644
index b92b6da..0000000
--- a/templates/base.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- LLLDAP
-
-
-
-{% block main %}
-{% endblock %}
-
-
diff --git a/templates/domain.html b/templates/domain.html
deleted file mode 100644
index 758ad65..0000000
--- a/templates/domain.html
+++ /dev/null
@@ -1,30 +0,0 @@
-{% extends 'base.html' %}
-{% block main %}
-
-
- You are logged in as {{ user.username }}
-
- {% if can_create_user %}
-
-
Create user
-
-
- {% endif %}
-
-
Users on {{ domain.name }}
-
- {% for user in users %}
- - {{ user.mail }}
- {% endfor %}
-
-
-
-{% endblock %}
-
diff --git a/templates/home.html b/templates/home.html
deleted file mode 100644
index d1f71b2..0000000
--- a/templates/home.html
+++ /dev/null
@@ -1,38 +0,0 @@
-{% extends 'base.html' %}
-{% block main %}
-
-
- You are logged in as {{ user.username }}
-
- {% if can_create_domain %}
-
-
Create domain
-
-
- {% endif %}
-
-
Active domains you can see
-
-
- {% if other_users %}
-
-
Other users you have permission to see on your own domain
-
- {% for user in other_users %}
- - {{ user.mail }}
- {% endfor %}
-
-
- {% endif %}
-
-{% endblock %}
-
diff --git a/templates/login.html b/templates/login.html
deleted file mode 100644
index 11ae59a..0000000
--- a/templates/login.html
+++ /dev/null
@@ -1,29 +0,0 @@
-{% extends 'base.html' %}
-{% block main %}
-
-
- {% if login_error == "InvalidCredentials" %}
-
- {% elif login_error == "SessionInvalidated" %}
-
- {% endif %}
-
-
-{% endblock %}
-