use super::SchemaCatalog;
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CatalogRowSecurity {
pub enabled: bool,
pub forced: bool,
pub policies: std::collections::BTreeMap<String, PolicyCommand>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PolicyCommand {
All,
Select,
Insert,
Update,
Delete,
}
impl SchemaCatalog {
pub fn relation_row_security(&self, name: &str) -> Option<&CatalogRowSecurity> {
let table = self.relation(name)?;
self.row_security
.get(&super::names::normalize_table_name(&table.name))
}
}