no_mistakes_postgres_engine/catalog/
row_security.rs1use super::SchemaCatalog;
2
3#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)]
4#[serde(rename_all = "camelCase")]
5pub struct CatalogRowSecurity {
6 pub enabled: bool,
7 pub forced: bool,
8 pub policies: std::collections::BTreeMap<String, PolicyCommand>,
9}
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize)]
12#[serde(rename_all = "lowercase")]
13pub enum PolicyCommand {
14 All,
15 Select,
16 Insert,
17 Update,
18 Delete,
19}
20impl SchemaCatalog {
21 pub fn relation_row_security(&self, name: &str) -> Option<&CatalogRowSecurity> {
23 let table = self.relation(name)?;
24 self.row_security
25 .get(&super::names::normalize_table_name(&table.name))
26 }
27}