Our customers table has an org_id column, and each org is a tenant in Supero. The table is live_read. How do I keep tenant A from seeing tenant B's rows?
One live Postgres table holds rows for several of our tenants
Common question, written up by the Supero team.
Linkrev 1
1 answer
Accepted answer
Accepted answer
Give that table a tenant_binding in column mode, inside its live block, mapping each Supero tenant name to its value in the source:
json
{
"schema": "customer",
"source": "public.customers",
"mode": "live_read",
"live": {
"tenant_binding": {
"mode": "column",
"tenant_field": "org_id",
"tenant_value_map": { "acme": "42", "globex": "77" },
"on_unmapped_tenant": "deny"
}
}
}Every read and write on the table is then filtered by org_id. A tenant with no entry in tenant_value_map is denied with a 403 rather than shown unfiltered rows; deny is the default.
Set this over the API with PUT /api/v1/connectors/{connector_id} and confirm it with a GET. The console wizard saves live tables with a fixed binding, which means the whole connector belongs to one tenant, so column mode is an API step.
Linkrev 1
Your answer
Know the answer? Sign in to post it. It takes an email address and a 6-digit code.
Sign in to answer