Skip to main content

scoped_query

Function scoped_query 

Source
pub fn scoped_query<R>(
    cx: &Cx,
) -> Result<Query<List<<R as Resource>::Model>>, Error>
where R: Resource,
Expand description

The tenant-scoped base query.

The resource’s rows as the context’s panel narrows them with ResourceDef::query, with the tenancy filter ANDed onto them, so no narrowing can drop the tenant scope, and with the trashed records of a resource that soft-deletes left out. Every framework loader and app code start here; scoped_query_in admits the trashed records too.

§Errors

A tenant-scoped resource and no tenant in cx: 403, the same answer the panel’s handlers give. A declaration error when the context’s panel does not mount R; a background job builds its context with PanelHandle::context.

App code that loads rows itself must call this: Query::all() reads every tenant’s rows and skips the panel’s narrowings.