Docs
Live demo

Rules and templates

A rule binds one identity to permissions on one target. A template is a versioned permission set shared across rules.

On this page

Rule structure#

A rule (policy in the API) binds who gets which permissions on which target (analytics → SELECT on warehouse.reporting.*): Who (user, service account or group, synced automatically, optionally nested), Where (one target), What (pinned template version or custom rule).

Swipe the screenshot sideways to see all of it, or tap it to open it full size.

A rule: who, where, which permissions, and its history.
  1. Apply sends the pending changes of this rule to the target. It opens a confirmation first.
  2. State: Changes not applied means the target does not match the rule yet.
  3. Operation banner: an operation of this rule that runs or waits for your decision.
  4. Who gets access.
  5. Where: the target and the template the rule follows, with its version.
  6. Permissions: privileges per resource. Columns group them into Read and Write.
  7. History of applies and changes. Decide answers an operation that waits for you.

Permissions and masks#

Engine Objects Example
PostgreSQL
database, schema, table, sequence, routine, type
SELECT, INSERT on app.public.orders
MySQL / MariaDB
server, database, table
SELECT on billing
ClickHouse
server, database, table
SELECT on events.*
MongoDB
all databases, database, collection
read on sales, find on orders.events
Kubernetes
namespaced, cluster, non-resource URLs
get, list on pods in analytics
  • ClickHouse clusters: ON CLUSTER DDL requires server-wide CLUSTER (cluster targets only).
  • Globs: * matches inside one name (app_*), ** matches any depth. ? and [ ] are disallowed, so no * is exact.
  • PostgreSQL paths and ALL: database-scoped paths start at schema (billing.* is schema billing, use billing.public.* or billing/** for the database). ALL on a schema mask also grants TEMPORARY on the database and EXECUTE on schema functions.

Templates#

Templates (postgres-read-only) belong to one organization for isolation and can leave databases or namespaces open for rules to place. Edits create versions: rules stay pinned until you preview and move them (Move rules to a new template version). Detach makes a rule custom (Create a template).

Swipe the screenshot sideways to see all of it, or tap it to open it full size.

A template shows its audience (who got access through it), the target of each rule and the state of each apply.
  1. Create rule from this template.
  2. Summary: grants, rules that use the template, last update.
  3. Audience: users and groups with a rule from this template, with the target and the apply state.

One rule per identity and target#

First rule wins so access has one source: group rules skip members with a personal rule, and personal rules are refused under a group rule (Change a rule).

  • Exceptions: Kubernetes SSO group-token targets bind the group directly. Temporary rules on databases and Kubernetes use a temporary account.
  • Takeover: leaving a group shifts access to another group’s rule on that target without dropping shared access (removing both revokes all). Applying a group rule claims uncovered members (Needs attention on Installation health).

Group rule modes#

Fixed at creation on PostgreSQL, MariaDB and ClickHouse:

Mode Behavior Notes
Member grants
Grants per member account.
Default. Used on Kubernetes outside SSO group tokens.
Group role
Grants to one role, adds members.
One edit touches one role. MariaDB: replaces default role. ClickHouse: keeps manual non-rule grants (ignored by drift, counted in Apply).

On PostgreSQL and MongoDB, rules are the full truth for managed accounts: apply, fix, narrowing and delete strip extra manual grants. Other engines: Drift.

Manage#

Rules · Create a rule · Templates · Rules API · Templates API · Grants API

↑ ↓ to moveEnter to openEsc to close