Compare commits
2 commits
3fecf86fd3
...
b7e31b9232
Author | SHA1 | Date | |
---|---|---|---|
b7e31b9232 | |||
ed07ecfcd3 |
5 changed files with 31 additions and 14 deletions
|
@ -12,3 +12,5 @@ REDIS_HOST=
|
||||||
REDIS_PORT=
|
REDIS_PORT=
|
||||||
SECRET_KEY=
|
SECRET_KEY=
|
||||||
|
|
||||||
|
# LDAP section
|
||||||
|
LDAP_ADMIN_PASSWORD=
|
|
@ -6,7 +6,7 @@ edition = { workspace = true }
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "4"
|
actix-web = "4"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
ldap3 = "0.10"
|
ldap3 = "0.11"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
env_logger = "0.10"
|
env_logger = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
1
crates/ldap/src/lib.rs
Normal file
1
crates/ldap/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -13,11 +13,7 @@ impl MigrationTrait for Migration {
|
||||||
Table::create()
|
Table::create()
|
||||||
.table(Project::Table)
|
.table(Project::Table)
|
||||||
.if_not_exists()
|
.if_not_exists()
|
||||||
.col(
|
.col(pk_uuid(Project::Id).extra("DEFAULT gen_random_uuid()"))
|
||||||
uuid(Project::Id)
|
|
||||||
.extra("DEFAULT gen_random_uuid()")
|
|
||||||
.primary_key(),
|
|
||||||
)
|
|
||||||
.col(string(Project::Name))
|
.col(string(Project::Name))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
@ -49,12 +45,8 @@ impl MigrationTrait for Migration {
|
||||||
Table::create()
|
Table::create()
|
||||||
.table(User::Table)
|
.table(User::Table)
|
||||||
.if_not_exists()
|
.if_not_exists()
|
||||||
.col(
|
.col(pk_uuid(User::Id).extra("DEFAULT gen_random_uuid()"))
|
||||||
uuid(User::Id)
|
.col(string_uniq(User::Name))
|
||||||
.extra("DEFAULT gen_random_uuid()")
|
|
||||||
.primary_key(),
|
|
||||||
)
|
|
||||||
.col(string(User::Name))
|
|
||||||
.col(string(User::Role))
|
.col(string(User::Role))
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
@ -101,6 +93,16 @@ impl MigrationTrait for Migration {
|
||||||
)
|
)
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
.await?;
|
||||||
|
manager
|
||||||
|
.create_table(
|
||||||
|
Table::create()
|
||||||
|
.table(LocalAuth::Table)
|
||||||
|
.if_not_exists()
|
||||||
|
.col(pk_uuid(LocalAuth::Id))
|
||||||
|
.col(string(LocalAuth::Hash))
|
||||||
|
.to_owned(),
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +119,10 @@ impl MigrationTrait for Migration {
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.drop_table(Table::drop().table(User::Table).to_owned())
|
.drop_table(Table::drop().table(User::Table).to_owned())
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
manager
|
||||||
|
.drop_table(Table::drop().table(UserGroupProject::Table).to_owned())
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,3 +157,10 @@ enum UserGroupProject {
|
||||||
GroupId,
|
GroupId,
|
||||||
ProjectId,
|
ProjectId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(DeriveIden)]
|
||||||
|
enum LocalAuth {
|
||||||
|
Table,
|
||||||
|
Id,
|
||||||
|
Hash,
|
||||||
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- openldap_data:/var/lib/ldap
|
- openldap_data:/var/lib/ldap
|
||||||
- openldap_config:/etc/ldap/slapd.d
|
- openldap_config:/etc/ldap/slapd.d
|
||||||
- users.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/users.ldif
|
# Custom LDAP configuration
|
||||||
|
- ./crates/ldap/src/users.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/users.ldif
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "ldapsearch", "-x", "-H", "ldap://localhost", "-b", "dc=Schule,dc=intern"]
|
test: ["CMD", "ldapsearch", "-x", "-H", "ldap://localhost", "-b", "dc=Schule,dc=intern"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue