Eligible repo support
This commit is contained in:
parent
2745eb85b1
commit
d7ffb2b831
|
@ -2,16 +2,22 @@
|
|||
pub struct ACL {
|
||||
trusted_users: Vec<String>,
|
||||
known_users: Vec<String>,
|
||||
repos: Vec<String>,
|
||||
}
|
||||
|
||||
impl ACL {
|
||||
pub fn new(trusted_users: Vec<String>, known_users: Vec<String>) -> ACL {
|
||||
pub fn new(repos: Vec<String>, trusted_users: Vec<String>, known_users: Vec<String>) -> ACL {
|
||||
return ACL {
|
||||
trusted_users: trusted_users,
|
||||
known_users: known_users,
|
||||
repos: repos,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn is_repo_eligible(&self, name: &str) -> bool {
|
||||
self.repos.contains(&name.to_lowercase())
|
||||
}
|
||||
|
||||
pub fn build_job_destinations_for_user_repo(
|
||||
&self,
|
||||
user: &str,
|
||||
|
|
|
@ -58,6 +58,7 @@ pub struct LogStorage {
|
|||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct RunnerConfig {
|
||||
pub identity: String,
|
||||
pub repos: Option<Vec<String>>,
|
||||
pub trusted_users: Option<Vec<String>>,
|
||||
pub known_users: Option<Vec<String>>,
|
||||
}
|
||||
|
@ -74,6 +75,9 @@ impl Config {
|
|||
|
||||
pub fn acl(&self) -> acl::ACL {
|
||||
return acl::ACL::new(
|
||||
self.runner.repos.clone().expect(
|
||||
"fetching config's runner.repos",
|
||||
),
|
||||
self.runner.trusted_users.clone().expect(
|
||||
"fetching config's runner.trusted_users",
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue