Skip to main content

Module row_scope

Module row_scope 

Source
Expand description

Row scoping: rows of a scoped entity reach only the sessions entitled to them.

An entity may name one string field as its scope field (the stack’s LiveSpec rowScopes, carried on the entity spec as scope_field). Each row’s value in that field is its scope id:

  • an absent, null or empty value makes the row public: every session receives it;
  • any other string makes it scoped: a session receives it only when its verified token’s row_scopes claim lists that id;
  • any other value makes it visible to nobody, so a malformed row fails closed.

The scopes a session may read come only from its verified token, never from the subscription request. A client’s own partition and filters still apply, but only on top of the scope check, so they can narrow what a session receives and never widen it. Sessions without the claim, and servers without authentication, receive only public rows of scoped entities. Entities without a scope field are unaffected.

Structs§

ScopeField
The field of a scoped entity’s rows that holds their scope id.

Enums§

RowScope
A row’s scope.

Constants§

DEFAULT_MAX_SCOPE_PARTITIONS
Default cap on the scope partitions one sorted view keeps (see SortedViewCache::partition_by_scope).

Functions§

session_row_scopes
The row scopes a verified session may read: its row_scopes claim, without empty ids. Empty for a session without the claim or without authentication.