diff --git a/src/bin/update_groups.rs b/src/bin/update_groups.rs index c1e7e18..b356964 100644 --- a/src/bin/update_groups.rs +++ b/src/bin/update_groups.rs @@ -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::>(); + + 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)?;