feat: mantain committee group as well
This commit is contained in:
parent
9cba5ce94a
commit
a3e95c5e10
1 changed files with 15 additions and 0 deletions
|
@ -9,6 +9,7 @@ async fn main() -> tide::Result<()> {
|
|||
|
||||
//update_users(&config).await;
|
||||
update_admin(&config).await?;
|
||||
update_committee(&config).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -34,6 +35,20 @@ async fn update_admin(config: &Config) -> tide::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_committee(config: &Config) -> tide::Result<()> {
|
||||
dotenv().ok();
|
||||
|
||||
// read from teh env
|
||||
if let Ok(x) = env::var("USERS_COMMITTEE") {
|
||||
let users = x.split(',').collect::<Vec<&str>>();
|
||||
|
||||
update_group(config, "skynet-committee", &users, true).await?;
|
||||
// admins automatically get added as users
|
||||
update_group(config, "skynet-users", &users, false).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update_group(config: &Config, group: &str, users: &[&str], replace: bool) -> tide::Result<()> {
|
||||
let mut ldap = LdapConn::new(&config.ldap_host)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue