ORE Studio 0.0.4
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
party_context Class Referencefinal

Manages party context for party-isolated database operations. More...

#include <party_context.hpp>

Collaboration diagram for party_context:
Collaboration graph

Static Public Member Functions

static context with_party (const context &ctx, const utility::uuid::tenant_id &tenant, const boost::uuids::uuid &party, const std::string &actor="")
 Creates a new context with tenant and party isolation.
 

Detailed Description

Manages party context for party-isolated database operations.

Party isolation is a second layer of RLS on top of tenant isolation. Tables with a party_id column use AS RESTRICTIVE FOR SELECT policies that filter rows to those visible to the current party (and its descendants in the party hierarchy).

Use with_party() to derive a new context that sets app.visible_party_ids on every connection, enabling all party-isolated reads and writes. Publishers must call this once per party before a batch of DML.

Member Function Documentation

◆ with_party()

context with_party ( const context ctx,
const utility::uuid::tenant_id tenant,
const boost::uuids::uuid &  party,
const std::string &  actor = "" 
)
static

Creates a new context with tenant and party isolation.

Queries ores_refdata_visible_party_ids_fn to compute the visible party set (the given party and all its descendants), then returns a new context that sets app.visible_party_ids on each connection acquire.

Parameters
ctxSource context (must already have tenant context set).
tenantTenant ID.
partyParty ID whose subtree should be visible.
actorOptional actor name for audit trail.
Returns
A new context configured for party-scoped operations.
Exceptions
std::runtime_errorif the party is not found in the tenant.