From bf3e5dbcab4bef25d91b2b096ad97094d6498a41 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Sat, 9 May 2020 11:17:09 -0700 Subject: [PATCH] treewide: remove code references to known users --- ofborg/src/acl.rs | 17 +---------------- ofborg/src/config.rs | 5 ----- ofborg/src/tasks/evaluationfilter.rs | 7 ++----- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/ofborg/src/acl.rs b/ofborg/src/acl.rs index 3e08a70..aeef24e 100644 --- a/ofborg/src/acl.rs +++ b/ofborg/src/acl.rs @@ -2,25 +2,18 @@ use crate::systems::System; pub struct ACL { trusted_users: Vec, - known_users: Vec, repos: Vec, } impl ACL { - pub fn new( - repos: Vec, - mut trusted_users: Vec, - mut known_users: Vec, - ) -> ACL { + pub fn new(repos: Vec, mut trusted_users: Vec) -> ACL { trusted_users .iter_mut() .map(|x| *x = x.to_lowercase()) .last(); - known_users.iter_mut().map(|x| *x = x.to_lowercase()).last(); ACL { trusted_users, - known_users, repos, } } @@ -53,14 +46,6 @@ impl ACL { .collect() } - pub fn can_build_restricted(&self, user: &str, repo: &str) -> bool { - if repo.to_lowercase() != "nixos/nixpkgs" { - return false; - } - - self.known_users.contains(&user.to_lowercase()) - } - pub fn can_build_unrestricted(&self, user: &str, repo: &str) -> bool { if repo.to_lowercase() == "nixos/nixpkgs" { self.trusted_users.contains(&user.to_lowercase()) diff --git a/ofborg/src/config.rs b/ofborg/src/config.rs index 1f3fc81..f5b4327 100644 --- a/ofborg/src/config.rs +++ b/ofborg/src/config.rs @@ -69,7 +69,6 @@ pub struct RunnerConfig { pub identity: String, pub repos: Option>, pub trusted_users: Option>, - pub known_users: Option>, /// If true, will create its own queue attached to the build job /// exchange. This means that builders with this enabled will @@ -100,10 +99,6 @@ impl Config { .trusted_users .clone() .expect("fetching config's runner.trusted_users"), - self.runner - .known_users - .clone() - .expect("fetching config's runner.known_users"), ) } diff --git a/ofborg/src/tasks/evaluationfilter.rs b/ofborg/src/tasks/evaluationfilter.rs index 5a2f10f..23b52a8 100644 --- a/ofborg/src/tasks/evaluationfilter.rs +++ b/ofborg/src/tasks/evaluationfilter.rs @@ -107,11 +107,8 @@ mod tests { let job: ghevent::PullRequestEvent = serde_json::from_str(&data.to_string()).expect("Should properly deserialize"); - let mut worker = EvaluationFilterWorker::new(acl::ACL::new( - vec!["nixos/nixpkgs".to_owned()], - vec![], - vec![], - )); + let mut worker = + EvaluationFilterWorker::new(acl::ACL::new(vec!["nixos/nixpkgs".to_owned()], vec![])); assert_eq!( worker.consumer(&job),