Insert rules into the RLS system table
(
db: &RelationalDB,
table_ids: impl IntoIterator<Item = TableId>,
rules: impl IntoIterator<Item = &'static str>,
)
| 453 | |
| 454 | /// Insert rules into the RLS system table |
| 455 | fn insert_rls_rules( |
| 456 | db: &RelationalDB, |
| 457 | table_ids: impl IntoIterator<Item = TableId>, |
| 458 | rules: impl IntoIterator<Item = &'static str>, |
| 459 | ) -> anyhow::Result<()> { |
| 460 | with_auto_commit(db, |tx| { |
| 461 | for (table_id, sql) in table_ids.into_iter().zip(rules) { |
| 462 | db.insert( |
| 463 | tx, |
| 464 | ST_ROW_LEVEL_SECURITY_ID, |
| 465 | &ProductValue::from(StRowLevelSecurityRow { |
| 466 | table_id, |
| 467 | sql: sql.into(), |
| 468 | }) |
| 469 | .to_bsatn_vec()?, |
| 470 | )?; |
| 471 | } |
| 472 | Ok(()) |
| 473 | }) |
| 474 | } |
| 475 | |
| 476 | /// Insert product values into a table |
| 477 | fn insert_rows( |
searching dependent graphs…