Reimplement task queries to account for special index swap rules

This commit is contained in:
Loïc Lecrenier 2022-10-27 11:17:50 +02:00
parent b44cc62320
commit 7b93ba40bd
12 changed files with 452 additions and 125 deletions

View file

@ -215,6 +215,27 @@ impl SearchRules {
}
}
}
/// Return the list of indexes such that `self.is_index_authorized(index) == true`,
/// or `None` if all indexes satisfy this condition.
pub fn authorized_indexes(&self) -> Option<Vec<String>> {
match self {
SearchRules::Set(set) => {
if set.contains("*") {
None
} else {
Some(set.iter().cloned().collect())
}
}
SearchRules::Map(map) => {
if map.contains_key("*") {
None
} else {
Some(map.keys().cloned().collect())
}
}
}
}
}
impl IntoIterator for SearchRules {