(
tx: &mut MutTxId,
auth_ctx: &AuthCtx,
rls: &RawRowLevelSecurityDefV9,
)
| 15 | |
| 16 | impl RowLevelExpr { |
| 17 | pub fn build_row_level_expr( |
| 18 | tx: &mut MutTxId, |
| 19 | auth_ctx: &AuthCtx, |
| 20 | rls: &RawRowLevelSecurityDefV9, |
| 21 | ) -> anyhow::Result<Self> { |
| 22 | let (sql, _) = parse_and_type_sub(&rls.sql, &SchemaViewer::new(tx, auth_ctx), auth_ctx)?; |
| 23 | let table_id = sql.return_table_id().unwrap(); |
| 24 | let schema = tx.schema_for_table(table_id)?; |
| 25 | |
| 26 | match schema.table_access { |
| 27 | StAccess::Private => { |
| 28 | anyhow::bail!( |
| 29 | "Cannot define RLS rule on private table: {}. \ |
| 30 | Please make table public if you wish to restrict access using RLS.", |
| 31 | schema.table_name |
| 32 | ) |
| 33 | } |
| 34 | StAccess::Public => Ok(Self { |
| 35 | def: RowLevelSecuritySchema { |
| 36 | table_id, |
| 37 | sql: rls.sql.clone(), |
| 38 | }, |
| 39 | sql, |
| 40 | }), |
| 41 | } |
| 42 | } |
| 43 | } |
nothing calls this directly
no test coverage detected