SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

RLS: Implement view expansion

Open joshua-spacetime opened this issue 10 months ago • 0 comments

Expanding a table reference into its RLS definition during query compilation. For example, if you have the following RLS rule:

/// A user only has access to their row
#[spacetimedb::client_visibility_filter]
const USER_FILTER: Filter = Filter::Sql("
    SELECT * FROM user WHERE identity = @sender
");

The query SELECT * FROM user will be expanded into:

SELECT * FROM (SELECT * FROM user WHERE identity = @sender)

joshua-spacetime avatar Mar 12 '25 00:03 joshua-spacetime