treewide: remove code references to known users
This commit is contained in:
parent
b6862c2b49
commit
bf3e5dbcab
|
@ -2,25 +2,18 @@ use crate::systems::System;
|
|||
|
||||
pub struct ACL {
|
||||
trusted_users: Vec<String>,
|
||||
known_users: Vec<String>,
|
||||
repos: Vec<String>,
|
||||
}
|
||||
|
||||
impl ACL {
|
||||
pub fn new(
|
||||
repos: Vec<String>,
|
||||
mut trusted_users: Vec<String>,
|
||||
mut known_users: Vec<String>,
|
||||
) -> ACL {
|
||||
pub fn new(repos: Vec<String>, mut trusted_users: Vec<String>) -> 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())
|
||||
|
|
|
@ -69,7 +69,6 @@ pub struct RunnerConfig {
|
|||
pub identity: String,
|
||||
pub repos: Option<Vec<String>>,
|
||||
pub trusted_users: Option<Vec<String>>,
|
||||
pub known_users: Option<Vec<String>>,
|
||||
|
||||
/// 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"),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue