Skip to content

Commit 273d2a9

Browse files
committed
remove rls bindings
1 parent 19a0a85 commit 273d2a9

8 files changed

Lines changed: 0 additions & 380 deletions

File tree

crates/bindings/src/client_visibility_filter.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

crates/bindings/src/lib.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use core::ops::Deref;
66
use spacetimedb_lib::bsatn;
77
use std::rc::Rc;
88

9-
#[cfg(feature = "unstable")]
10-
mod client_visibility_filter;
119
#[cfg(feature = "unstable")]
1210
pub mod http;
1311
pub mod log_stopwatch;
@@ -22,8 +20,6 @@ pub mod table;
2220
#[doc(hidden)]
2321
pub use spacetimedb_query_builder as query_builder;
2422

25-
#[cfg(feature = "unstable")]
26-
pub use client_visibility_filter::Filter;
2723
pub use log;
2824
#[cfg(feature = "rand")]
2925
pub use rand08 as rand;
@@ -61,44 +57,6 @@ pub type ProcedureResult = Vec<u8>;
6157

6258
pub use spacetimedb_bindings_macro::duration;
6359

64-
/// Generates code for registering a row-level security rule.
65-
///
66-
/// This attribute must be applied to a `const` binding of type [`Filter`].
67-
/// It will be interpreted as a filter on the table to which it applies, for all client queries.
68-
/// If a module contains multiple `client_visibility_filter`s for the same table,
69-
/// they will be unioned together as if by SQL `OR`,
70-
/// so that any row permitted by at least one filter is visible.
71-
///
72-
/// The `const` binding's identifier must be unique within the module.
73-
///
74-
/// The query follows the same syntax as a subscription query.
75-
///
76-
/// ## Example:
77-
///
78-
/// ```no_run
79-
/// # #[cfg(target_arch = "wasm32")] mod demo {
80-
/// use spacetimedb::{client_visibility_filter, Filter};
81-
///
82-
/// /// Players can only see what's in their chunk
83-
/// #[client_visibility_filter]
84-
/// const PLAYERS_SEE_ENTITIES_IN_SAME_CHUNK: Filter = Filter::Sql("
85-
/// SELECT * FROM LocationState WHERE chunk_index IN (
86-
/// SELECT chunk_index FROM LocationState WHERE entity_id IN (
87-
/// SELECT entity_id FROM UserState WHERE identity = :sender
88-
/// )
89-
/// )
90-
/// ");
91-
/// # }
92-
/// ```
93-
///
94-
/// Queries are not checked for syntactic or semantic validity
95-
/// until they are processed by the SpacetimeDB host.
96-
/// This means that errors in queries, such as syntax errors, type errors or unknown tables,
97-
/// will be reported during `spacetime publish`, not at compile time.
98-
#[cfg(feature = "unstable")]
99-
#[doc(inline, hidden)] // TODO: RLS filters are currently unimplemented, and are not enforced.
100-
pub use spacetimedb_bindings_macro::client_visibility_filter;
101-
10260
/// Declares a table with a particular row type.
10361
///
10462
/// This attribute is applied to a struct type with named fields.

crates/bindings/src/rt.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -803,13 +803,6 @@ where
803803
})
804804
}
805805

806-
/// Registers a row-level security policy.
807-
pub fn register_row_level_security(sql: &'static str) {
808-
register_describer(|module| {
809-
module.inner.add_row_level_security(sql);
810-
})
811-
}
812-
813806
/// A builder for a module.
814807
#[derive(Default)]
815808
pub struct ModuleBuilder {

modules/sdk-test/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,6 @@ define_tables! {
787787
#[spacetimedb::reducer]
788788
fn no_op_succeeds(_ctx: &ReducerContext) {}
789789

790-
#[spacetimedb::client_visibility_filter]
791-
const ONE_U8_VISIBLE: spacetimedb::Filter = spacetimedb::Filter::Sql("SELECT * FROM one_u8");
792-
793790
#[spacetimedb::table(name = scheduled_table, scheduled(send_scheduled_message), public)]
794791
pub struct ScheduledTable {
795792
#[primary_key]
@@ -825,9 +822,6 @@ struct BTreeU32 {
825822
data: i32,
826823
}
827824

828-
#[spacetimedb::client_visibility_filter]
829-
const USERS_FILTER: spacetimedb::Filter = spacetimedb::Filter::Sql("SELECT * FROM users WHERE identity = :sender");
830-
831825
#[spacetimedb::table(name = users, public)]
832826
struct Users {
833827
#[primary_key]

sdks/rust/tests/test-client/src/main.rs

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ fn main() {
134134
"test-intra-query-bag-semantics-for-join" => test_intra_query_bag_semantics_for_join(),
135135
"two-different-compression-algos" => exec_two_different_compression_algos(),
136136
"test-parameterized-subscription" => test_parameterized_subscription(),
137-
"test-rls-subscription" => test_rls_subscription(),
138137
"pk-simple-enum" => exec_pk_simple_enum(),
139138
"indexed-simple-enum" => exec_indexed_simple_enum(),
140139

@@ -2548,67 +2547,6 @@ fn test_parameterized_subscription() {
25482547
ctr_for_test.wait_for_all();
25492548
}
25502549

2551-
/// In this test we have two clients subscribe to the `users` table.
2552-
/// Access to this table is controlled using the following RLS rule:
2553-
/// ```rust
2554-
/// #[spacetimedb::client_visibility_filter]
2555-
/// const USERS_FILTER: spacetimedb::Filter = spacetimedb::Filter::Sql(
2556-
/// "SELECT * FROM users WHERE identity = :sender"
2557-
/// );
2558-
/// ```
2559-
/// Hence each client should receive different rows.
2560-
fn test_rls_subscription() {
2561-
let ctr_for_test = TestCounter::new();
2562-
let ctr_for_subs = TestCounter::new();
2563-
let sub_0 = Some(ctr_for_subs.add_test("sub_0"));
2564-
let sub_1 = Some(ctr_for_subs.add_test("sub_1"));
2565-
let ins_0 = Some(ctr_for_test.add_test("insert_0"));
2566-
let ins_1 = Some(ctr_for_test.add_test("insert_1"));
2567-
2568-
fn subscribe_and_update(
2569-
test_name: &str,
2570-
user_name: &str,
2571-
waiters: [Arc<TestCounter>; 2],
2572-
senders: [Option<ResultRecorder>; 2],
2573-
) {
2574-
let [ctr_for_test, ctr_for_subs] = waiters;
2575-
let [mut record_sub, mut record_ins] = senders;
2576-
let user_name = user_name.to_owned();
2577-
let expected_name = user_name.to_owned();
2578-
connect_with_then(&ctr_for_test, test_name, |builder| builder, {
2579-
move |ctx| {
2580-
let sender = ctx.identity();
2581-
let expected_identity = sender;
2582-
subscribe_these_then(ctx, &["SELECT * FROM users"], move |ctx| {
2583-
put_result(&mut record_sub, Ok(()));
2584-
// Wait to insert until both client connections have been made
2585-
ctr_for_subs.wait_for_all();
2586-
ctx.reducers.insert_user(user_name, sender).unwrap();
2587-
});
2588-
ctx.db.users().on_insert(move |_, user| {
2589-
assert_eq!(user.name, expected_name);
2590-
assert_eq!(user.identity, expected_identity);
2591-
put_result(&mut record_ins, Ok(()));
2592-
});
2593-
}
2594-
});
2595-
}
2596-
2597-
subscribe_and_update(
2598-
"client_0",
2599-
"Alice",
2600-
[ctr_for_test.clone(), ctr_for_subs.clone()],
2601-
[sub_0, ins_0],
2602-
);
2603-
subscribe_and_update(
2604-
"client_1",
2605-
"Bob",
2606-
[ctr_for_test.clone(), ctr_for_subs.clone()],
2607-
[sub_1, ins_1],
2608-
);
2609-
ctr_for_test.wait_for_all();
2610-
}
2611-
26122550
fn exec_pk_simple_enum() {
26132551
let test_counter: Arc<TestCounter> = TestCounter::new();
26142552
let mut updated = Some(test_counter.add_test("updated"));

sdks/rust/tests/test.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,6 @@ macro_rules! declare_tests_with_suffix {
261261
make_test("test-parameterized-subscription").run();
262262
}
263263

264-
#[test]
265-
fn test_rls_subscription() {
266-
make_test("test-rls-subscription").run()
267-
}
268-
269264
#[test]
270265
fn pk_simple_enum() {
271266
make_test("pk-simple-enum").run();

smoketests/tests/fail_initial_publish.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)