Identity and access
PartialIdentity and access decides who may call Omniglass and which slice of the fleet each caller sees and acts on. It is enforced entirely in the application, in two layers, each held in one place. To operate it, see the admin Users page and Access.
The two invariants
Section titled “The two invariants”- A permission on every route. Every API operation is either registered through one helper,
gated(op, resource, action), which installs the authentication and permission middleware ahead of the handler, or sits on a short, explicit allow-list of public and self-scoped routes. A route cannot be added ungated by omission:TestEveryRouteIsGateddrives every operation in the generated OpenAPI with a signed-in user holding no permission and fails on anything but a 403 outside that list. - ABAC scope injected by the Storage Gateway on every query. Every gateway method over a scoped
resource takes the caller’s resolved scope,
visible_set(P, action), as a requiredscope.Setargument and turns it into a parameterized filter on the row’s owner. The Storage Gateway is the only path to the database (no row-level security, no PostgREST), so there is no unscoped path to forget.
The route permission is a fast reject, never the authorization: it asks only whether the caller holds the action in any grant. The scope decides whether the caller may act on this row. A handler that forgot its own check still could not query unscoped, because the scope is an argument the gateway requires.
Users and credentials
Section titled “Users and credentials”A user is who a role is granted to, identified by an opaque uuid, never an email or a name
(ADR-2036).
users.kind is one of two:
| kind | is | signs in with |
|---|---|---|
person | someone who signs in | a password and a session cookie, or single sign-on |
machine | a script, an integration, or an outpost | a bearer token; an outpost its enrollment |
Each kind has a one-to-one detail table holding its own identifier, each unique, since each is the
only handle its user has and each is copied into the audit trail
(ADR-0111):
a person’s username, a machine user’s name, an outpost’s name on its outpost row.
An AI is not a third kind. It acts as a person through an agent token that person minted for it, with at most that person’s authority.
Credentials
Section titled “Credentials”A user holds any number of credential rows. credential.kind is password, bearer or oidc,
and purpose tells a session from a token:
| credential | kind | lifetime |
|---|---|---|
| console session | bearer, purpose session | 12 hours, fixed |
| API or CLI token | bearer, purpose token | 90 days by default, at most 365 |
| password | password, one per person | argon2id, until changed |
| identity provider link | oidc | until unlinked |
- A bearer token is
ogp_<locator>_<secret>: a prefix for secret scanners, a non-secret locator, and a 192-bit random secret. The server stores only itssha256and returns the token once, at mint. Every credential expires (ADR-0019), checked at authentication. - A password is at least 12 characters, not on a common-password list, and does not contain the
username (
auth.ValidatePassword). Five consecutive misses lock the person for 15 minutes, refused with the same 401 as a bad password, so the lock is not an enumeration oracle; changing the password clears it. An admin reset can require a change at next sign-in, which refuses every route but the change itself until it is made. - Every bearer credential carries identifying metadata: a description, the user agent and client
address that created it, and when it was last used. The client address believes a forwarded header
only from a configured trusted proxy (
OMNIGLASS_TRUSTED_PROXIES) (ADR-1185).
Single sign-on
Section titled “Single sign-on”A person can sign in through an OpenID Connect provider
(ADR-2361).
An oidc credential is a link from the person to the provider’s subject: it holds no Omniglass
secret, only the provider’s sealed refresh token, and a sign-in through it mints the ordinary
session. A link is made explicitly, by an admin under the takeover guard or by the person after
confirming their current password, never by matching an email. The sign-in is the code flow with
PKCE and a nonce derived from the browser binding rather than stored
(ADR-2362),
and every call to the provider goes through the egress allow list. A sweep redeems each link’s
refresh token every sso.recheck_minutes (15 by default) and revokes the sessions and tokens made
through it once the provider refuses. Owners keep password sign-in as break-glass.
Provider groups map to Omniglass user groups so scoped grants follow the directory
(#2363): a groups-claim value keyed by issuer
maps to a user_group (/user-groups/{group}/idp-mappings, gated user_group). The sign-in and each
re-check refresh whose id_token carries the claim sync that issuer’s idp memberships in their own
transaction, audited. The owner guard refuses both a mapping to a group with an owner grant and an
owner grant on a mapped group
(ADR-2363).
Agent tokens
Section titled “Agent tokens”An agent token is a token type on the person’s own credential, not a user of its own
(ADR-1179).
POST /auth/me/tokens with an agent name mints one; it always expires, and two fields narrow it:
roles: the agent’s own grant, intersected with its person’s current permissions on every request (rbac.Set.Within), so narrowing or revoking the person narrows or stops the agent at its next call. The scope the gateway injects is the person’s.channels: where the token is accepted (api,mcp), checked against the channel the server sets on the request, which no caller can claim.
The plaintext ceiling. An agent token never holds a reveal or enroll action, whatever its
roles: authentication strips them (rbac.Set.Without), so even an owner’s > loses them, and the
same applies to any token used through MCP. An agent works with a credential only through routes that
use it server-side. Everything else its person may do, it may do
(ADR-2047),
including binding a secret to a target, which takes secret:bind for any caller. An agent token is
refused minting a token, changing a password, and impersonation. Every write it makes records its
person as the actor and the agent’s name in the audit row’s agent.
MCP clients sign in with OAuth 2.1
Section titled “MCP clients sign in with OAuth 2.1”An MCP client gets an agent token without its person minting one, through the OAuth 2.1 authorization code flow the MCP authorization spec names (ADR-2048). Omniglass is both the resource server and the authorization server:
- Discovery.
/mcpanswers a request with no token with a challenge naming/.well-known/oauth-protected-resource/mcp, which names the server’s own/.well-known/oauth-authorization-server. - Registration.
POST /oauth/registeris open dynamic registration of a public client, with https or loopback redirect URIs. A client may instead name itself by an https URL serving its metadata, fetched through the egress contract and never from a private address (ADR-2074). - Consent.
GET /oauth/authorize(code flow, S256 PKCE, the/mcpresource) leads to a console consent page where the signed-in person approves roles they cover. An agent token cannot consent. - Exchange and refresh.
POST /oauth/tokenspends the five-minute code and mints an agent token on themcpchannel only, good for an hour, with a refresh token good for 30 days that rotates on every use; a spent refresh token presented again ends the grant (ADR-2073).
The token is an ordinary agent token from then on.
The outpost’s credential
Section titled “The outpost’s credential”An outpost is a machine user. An admin mints its enrollment token (outpost:enroll), and the
outpost presents it to POST /outposts:claim, the one public route that takes a credential in its
body, in exchange for its bus connection details. The embedded NATS server authenticates each
connection in process and grants it publish and subscribe only on that outpost’s own subjects, so an
outpost cannot publish or pull as another
(ADR-0036).
What an outpost’s batch may write is then held at the gateway: every row lands on the component its
task collects for, under the writer class its keys
admit.
A role is a named bundle of permissions, which may inherit another role’s. Permissions are topic
patterns matched like NATS subjects
(ADR-0015):
colon-separated tokens, where * matches exactly one token and > matches one or more and must be
last.
component:read one permissioncomponent:create,update expands to twoalarm:acknowledge a domain verb beside the CRUD verbsuser:* any single action on one resourceaudit:read:admin an admin-tier permission, three tokens> everything, at every tier (owner)- The admin tier is a deeper token. Because
*matches one token,*:readcannot reachaudit:read:admin. The directories of users, roles and user groups read at this tier (ADR-0023). - Sensitive resources. A bare
*never namessecret,settings,platformornotification_target; only a literal grant, a resource wildcard (secret:*) or>does (ADR-0025). - The read floor. Any permission on a resource implies reading it, evaluated in the matcher on
every call (
rbac.Set.Allows) rather than expanded ahead. - Additive only. Inheritance composes by union, and there is no negative permission; to narrow, define a narrower role.
The five official roles, their inheritance and their effective permissions, rendered from
internal/seed/roles.yaml through the same rbac path the authorizer runs
(#722):
Viewer (viewer ): Read-only access to everything, and subscribing yourself to the alarms you can see. The floor every other role inherits.
Effective permissions (3):
*:readnotification:subscribeassistant:use
Operator (operator inherits viewer): Day-to-day operations: create or edit components, endpoints (retry an endpoint's rejected session, or run its poll now), secrets, variables, the property, metric, event, command and notification catalogs, issue commands in scope, preview a driver spec through an outpost, and impair simulated components. Sees, reveals and binds the device secrets in its scope (never the admin-sensitive platform credentials). Inherits Viewer.
Effective permissions (37):
component:createcomponent:updatecomponent:renamecomponent:moveendpoint:createendpoint:updateendpoint:retryendpoint:rundriver:previewsecret:readsecret:revealsecret:bindsecret:createsecret:updatevariable:createvariable:updateproperty_type:createproperty_type:updatemetric_type:createmetric_type:updateevent_type:createevent_type:updatecommand_type:createcommand_type:updatenotification_type:createnotification_type:updatecommand:issuesimulation:updatealarm:acknowledgealarm:snoozenotification:retrytelemetry:pushfile:createfile:delete*:readnotification:subscribeassistant:use
Deploy (deploy inherits viewer): Integrator or field tech: create, update, rename, and move on locations, systems, and components, and no delete. Granted at a location with the "under only" operator, it builds out and edits the rooms under that location, never the location itself, plus the secrets those locations own. The same grant reads the systems and components placed in that location and creates new ones there, but does not edit, rename, or move them: that takes a system-scoped or component-scoped grant of this role, until a location grant's scope spans the modify actions too. Inherits Viewer, whose read floor is scoped the same way.
Effective permissions (21):
location:createlocation:updatelocation:renamelocation:movesystem:createsystem:updatesystem:renamesystem:movecomponent:createcomponent:updatecomponent:renamecomponent:movesecret:readsecret:revealsecret:bindsecret:createsecret:updatefile:create*:readnotification:subscribeassistant:use
Administrator (admin inherits operator): Manages the fleet, users, roles, and grants: full create, update, and delete on locations, systems, and components, and on users, credentials, grants, and roles. Deliberately NOT the superuser: it cannot grant a role above its own tier, so it cannot make itself owner. Inherits Operator.
Effective permissions (101):
component:deleteendpoint:*task:*system:createsystem:updatesystem:deletesystem:renamesystem:movelocation:createlocation:updatelocation:deletelocation:renamelocation:moveuser:*user:read:adminuser:purge:adminsecret:>file:>variable:*platform:*settings:readsettings:updateuser_grant:*user_group:*user_group:read:adminoutpost:*role:read:adminaudit:read:adminproperty_type:*metric_type:*event_type:*severity_level:*rule:*command_type:*notification_type:*notification_target:*command:*location_type:createlocation_type:updatelocation_type:deletelocation_type:renamecomponent_type:createcomponent_type:updatecomponent_type:deletesystem_type:createsystem_type:updatesystem_type:deletevendor:createvendor:updatevendor:deletevendor:renamedriver:createdriver:updatedriver:deletedriver:renameproduct:createproduct:updateproduct:deleteproduct:renamestandard:createstandard:updatestandard:deletestandard:renametag:*component:createcomponent:updatecomponent:renamecomponent:moveendpoint:createendpoint:updateendpoint:retryendpoint:rundriver:previewsecret:readsecret:revealsecret:bindsecret:createsecret:updatevariable:createvariable:updateproperty_type:createproperty_type:updatemetric_type:createmetric_type:updateevent_type:createevent_type:updatecommand_type:createcommand_type:updatenotification_type:createnotification_type:updatecommand:issuesimulation:updatealarm:acknowledgealarm:snoozenotification:retrytelemetry:pushfile:createfile:delete*:readnotification:subscribeassistant:use
Owner (owner ): Full control of everything, the break-glass superuser (the tail wildcard, so it covers every capability at every tier, including admin-sensitive ones and future resources). At least one active owner always exists, and an owner account cannot be impersonated.
Effective permissions (1):
>
viewer reads every operator-facing resource in scope, but no secret and no IAM directory. operator
runs the fleet and holds the device secrets in its scope, never an admin-sensitive platform
credential. deploy is the integrator’s role, usually granted with the subtree_excl_root operator
(below). admin adds platform:* and the IAM directories but cannot
grant a role above its own. owner is >, break-glass, and cannot be impersonated.
A role row carries a namespace (og for the shipped five) and an official flag. Roles are
read-only today: GET /roles (role:read:admin) lists them, and the console’s role blade shows each
against the permission universe, held versus missing.
The permission universe, published per route
Section titled “The permission universe, published per route”gated(...) does three things together: it installs the middleware, stamps the operation with the
x-omniglass-permission OpenAPI extension, and records the permission in an in-process catalog. So
the authorization contract is published in the generated api/openapi.json, and the permission
universe is derived from the routes with no hand-kept list. A route with a second gate stamps it
too: x-omniglass-platform-permission for a platform-tier write, and
x-omniglass-conditional-permission for one the request’s body triggers (a component create naming a
system also needs system:update). Three guards keep it honest: every route outside the allow-list
carries a stamp and none on the list does; every permission a seeded role grants resolves into the
universe; and the docs lint fails on a permission named in prose that gates no route.
Grants: role times scope
Section titled “Grants: role times scope”A grant is a (role, scope_kind, scope_id, scope_op) row in user_grant, held by a user or by a
user group. A user’s grants are additive:
canDo(P, action, E) iff some grant g of P has action in perms(g.role) and E in expand(g.scope)The action and the entity are satisfied by the same grant. Flattening every permission into one
set and every scope into another would over-permit: operator @ room-A plus viewer @ all must not
acknowledge an alarm in room B. So the gateway’s set is resolved per action:
visible_set(P, action) is the union of the scopes of only the grants whose role carries that action
(internal/scope, pure). Reading is the widest set, since every grant carries the read floor, so a
user can read a row it cannot act on, never the reverse.
Scopes and scope operators
Section titled “Scopes and scope operators”scope_kind is all, location, system or component, and a scope reaches its root and
everything structurally beneath it. scope_op says how the root matches:
| operator | in scope | for |
|---|---|---|
subtree (default) | the root and everything beneath it | every action |
subtree_excl_root | for update and delete, only what is beneath the root | lets a field tech build out a subtree without editing its root |
self | exactly the root row | read, update, delete; never a create beneath it |
Operators combine by union across grants, an inclusive grant winning over an excluding one.
A location grant reads and creates what is placed in it
(ADR-1498).
A subtree location grant carrying system:read or component:read also reaches the systems and
components whose placement is in that subtree, and their create. Every read derived from a
component’s scope (its alarms, notifications, dependencies) follows through the same filter.
Each resource registers which grant kinds can contain it (applicableKinds in internal/scope): a
tier (an alarm, a command or an endpoint on the component tier; pushed telemetry on the component and
system tiers), or fleet-wide, which only an all grant confers. TestEveryGatedResourceRegistersItsScope
reads every permission stamp in the generated spec and fails on a resource registered nowhere, and the
gateway answers a set resolved for the wrong tier with a wiring error, a 500, never the 404 an empty
grant would earn.
Install-wide authority is not fleet scope
Section titled “Install-wide authority is not fleet scope”The cascade’s least-specific tier is platform, the value for the whole
install. A write there needs two permissions, the resource’s own and platform:<action>
(ADR-0057):
variable:update + platform:update change the install-wide value of a variablesecret:create + platform:create seal a secret at the platform tiersettings:update + platform:update every settings writeA scope says how much of the fleet a grant reaches; platform:<action> says whether the user may
change the value under all of it. platform is a sensitive resource, so a custom role with
*:update still holds no install-wide authority. Only admin is seeded platform:*.
The owner invariant
Section titled “The owner invariant”At least one active owner @ all grant exists at all times. A deferred constraint trigger
(user_grant_owner_guard) checks it at commit, so swapping owners in one transaction works, and
removing the last one (by revoking, disabling, archiving or purging) is refused with a 409. It is the
one rule the schema holds rather than Go, because only commit time can see two transactions each
revoking the second-to-last owner.
Grants cannot exceed the granter
Section titled “Grants cannot exceed the granter”A grant is refused (403) unless the granter’s own all-scope permissions cover the role it confers
(rbac.Set.Covers, pattern subsumption)
(ADR-0013).
No partial wildcard covers >, so an admin cannot grant owner, and a capability held only through a
narrower grant cannot be conferred fleet-wide. Users, roles and grants are governed only by all-scope
grants: a scoped admin gets no IAM.
Enforcement: where each check lives
Section titled “Enforcement: where each check lives”A targeted write passes three checkpoints, each one code seam:
Grants are read from the database on every request; the role index loads once per process, since roles are read-only today.
The three-way status split
Section titled “The three-way status split”A refusal picks its status from the difference between two scopes:
| the target is | status | why |
|---|---|---|
| in no grant carrying the action | 403 | the fast reject, before the gateway |
in visible_set(P, read), outside visible_set(P, action) | 403 | the caller can already read this row, so naming the missing authority discloses nothing |
outside visible_set(P, read) | 404 | the caller must not learn the row exists |
One primitive makes the split for every route that has one (resolveScoped, and
ResolveActionTarget for the routes whose write takes no scope of its own), so the order, read then
action, exists in one place. An action resolves on its own permission, never the target entity’s
write: acknowledging an alarm resolves on alarm:acknowledge, issuing a command on command:issue,
pushing telemetry on telemetry:push
(ADR-0117).
The read set is always the caller’s own <resource>:read, because the truthful 403 names a row and
may only reach someone who could have read it.
A create has no target yet, so the split is made on the row it is placed under. A location created under a parent the caller cannot read answers the same 404 as a parent that does not exist (ADR-1343).
A reference resolves within a scope
Section titled “A reference resolves within a scope”A location, system or component may be addressed by uuid, bare name or dotted address
(ADR-0089),
and every form goes through one resolver before the decision above: scope decides before ambiguity
does. A bare name is narrowed to the caller’s scope first, then judged ambiguous only within it, so
an operator scoped to one room can say display-1 while an unrelated room holds the same name, and an
ambiguity refusal lists only candidates the caller can read. The same rule reaches every resource
whose name is unique only inside something else: an endpoint (<component>/<name>), a secret or a
variable (<owner>/<name>), a file, a user group and its members
(ADR-1133).
A bind costs a write on both of its ends. A component created into a system writes that system’s
membership, so it needs system:update
(ADR-0107);
a membership or slot write naming a component needs component:update on it
(ADR-0510).
Resources with no owner
Section titled “Resources with no owner”Catalogs, directories and settings describe the install, not the fleet, so they carry no owner to scope by:
- Users, roles and grants: the action must be in an all-scope grant.
- Catalogs (the metric, property, event and command types, tags, products, standards): each its
own resource with its own verbs (
property_type:create,standard:update), so a curator role mints entries without IAM. A shipped row is forked, never written (storage). - Settings: the permission alone gates them, a recorded carve-out (ADR-0034, settings).
Coverage grows with the surface, by test
Section titled “Coverage grows with the surface, by test”- An authorization conformance matrix runs the full set (the 403 on a missing permission, the over-permit 403, the non-disclosing 404, in-scope success) against every scoped entity in a catalog, and through each route that hangs off one. A new scoped entity is one catalog line.
TestEveryRouteIsGatedholds the route invariant above. Its allow-list is the public routes (the liveness probe, sign-in and its status, the outpost claim, and the webhook receiver, whose token names one endpoint and whose driver’s scheme authenticates the sender, ADR-1024) and the self-scoped/auth/mefamily andGET /settings/me, which act only on the caller.
User groups
Section titled “User groups”A user group is a set of users that holds grants. Every member inherits the group’s grants
through the same loader as their own, and a group grant is bounded by the same cover check as a
direct one. Membership is static and flat, and each row carries a source (local, or idp with its
issuer when synced from a provider’s groups claim). The /user-groups routes manage groups, members and
grants, gated on user_group.
People as notification audiences
Section titled “People as notification audiences”A user group, a person or a role is also an audience for alarm notifications
(alarms and actions).
The scope invariant holds for what a person is told, not only what they query: each member is told
only when their own component read scope admits the alarm’s component, judged at the transition and
again when they read their inbox, so a revoked grant empties the entry at once
(ADR-1341).
A person subscribes themselves with notification:subscribe, which viewer carries.
Impersonation
Section titled “Impersonation”An owner or all-scope admin holding user:impersonate can see or act through another user, for
troubleshooting. View-as resolves reads under the target’s scope and refuses every write;
act-as is full, and every write records both the target and the real actor.
POST /users/{id}:impersonate mints a bounded token (30 minutes by default) held in
impersonation_session, apart from credentials. An owner cannot be impersonated by anyone, a caller
may impersonate only a user whose permissions its own cover, and act-as needs the caller’s all-scope
grants alone to cover the target. Disabling either party ends the session at its next request.
Sessions and the self-service surface
Section titled “Sessions and the self-service surface”GET /auth/me returns the caller, their grants, and the flat union of their roles’ raw patterns.
The console uses the patterns only to hide or explain (a button the caller could never use, a page
they cannot read, which renders a denied face naming the permission); the server’s check on every
route is the control.
The /auth/me family acts only on the caller: editing their profile, changing their password,
listing and revoking their own sessions and tokens (keeping the one making the request), and minting
a token. The admin counterparts act on another user and carry permissions:
user:reset-password, user:revoke-session, user:set-avatar. A reset and a session revoke sit
behind the takeover guard: nobody can do either to an owner, or to a user whose permissions exceed
their own.
A user’s lifecycle is reversible until the end: :disable and :enable; :archive and :restore,
which hide the account and block sign-in; and :purge, which deletes it, needs prior archival and
user:purge:admin, and keeps the audit trail by the actor’s name copied onto each row.
A profile picture is normalized on the server (JPEG, PNG or WebP in, at most 8 MiB and 8000 pixels a side, cropped and re-encoded to a 256 pixel square JPEG) and read back as JSON, not raw bytes, so its route stays behind the same middleware as every other (ADR-0018).
Bootstrap and break-glass
Section titled “Bootstrap and break-glass”omniglass bootstrap <username> creates the first owner in one transaction, with an owner @ all
grant and a token, and with --password a password for the console. There is no default user. Two
direct-database commands are the recovery path and skip the password policy, since they already need
database access: bootstrap, and omniglass set-password, which also revokes the person’s sessions
and, with --revoke-tokens, their tokens. It is the one way to cut off a compromised owner, since
every API reset and revoke refuses an owner target.
Storage
Section titled “Storage”The users, their grants and the roles; the patterns behind them are on storage.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
kind | text | not null | person or machine; the per-kind table holds the rest, and an outpost's machine user keeps its detail on its outpost row |
created_at | timestamp with time zone | not null, default now() | |
active | boolean | not null, default true | |
archived_at | timestamp with time zone | ||
seq | bigint | not null |
CHECK constraints and unique indexes on users
-
users_kind_check:CHECK ((kind = ANY (ARRAY['person'::text, 'machine'::text])))
| Column | Type | Constraints | Notes |
|---|---|---|---|
user_id | uuid | PK, FK → users.id | |
username | text | not null | |
email | text | ||
label | text | The person's real name, the operator-facing label | |
failed_login_count | integer | not null, default 0 | |
locked_until | timestamp with time zone | ||
must_change_password | boolean | not null, default false | |
avatar | text | ||
avatar_updated_at | timestamp with time zone |
CHECK constraints and unique indexes on person
-
person_username_key:CREATE UNIQUE INDEX person_username_key ON public.person USING btree (username)
| Column | Type | Constraints |
|---|---|---|
user_id | uuid | PK, FK → users.id |
name | text | not null |
CHECK constraints and unique indexes on machine
-
machine_name_key:CREATE UNIQUE INDEX machine_name_key ON public.machine USING btree (name)
| Column | Type | Constraints | Notes |
|---|---|---|---|
name | text | not null | |
official | boolean | not null, default false | Shipped with the binary; the og namespace is always official |
permissions | ARRAY | not null, default '{}'::text[] | The permission patterns the role grants |
inherits | ARRAY | not null, default '{}'::text[] | |
created_at | timestamp with time zone | not null, default now() | |
label | text | ||
description | text | ||
id | uuid | PK, default uuidv7() | |
namespace | text | not null, default 'local'::text |
CHECK constraints and unique indexes on role
-
role_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
role_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
role_namespace_name_key:CREATE UNIQUE INDEX role_namespace_name_key ON public.role USING btree (namespace, name)
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
user_id | uuid | FK → users.id | |
scope_kind | text | not null | Which tier the scope roots in, or all |
scope_id | text | ||
created_at | timestamp with time zone | not null, default now() | |
scope_op | text | not null, default 'subtree'::text | How the root matches the tree: subtree, subtree_excl_root or self |
group_id | uuid | FK → user_group.id | |
role_id | uuid | FK → role.id, not null |
CHECK constraints and unique indexes on user_grant
-
user_grant_scope_kind_check:CHECK ((scope_kind = ANY (ARRAY['all'::text, 'location'::text, 'system'::text, 'component'::text]))) -
user_grant_scope_op_check:CHECK ((scope_op = ANY (ARRAY['subtree'::text, 'subtree_excl_root'::text, 'self'::text]))) -
user_grant_target_ck:CHECK ((num_nonnulls(user_id, group_id) = 1)) -
user_grant_unique:CREATE UNIQUE INDEX user_grant_unique ON public.user_grant USING btree (user_id, role_id, scope_kind, COALESCE(scope_id, ''::text), scope_op) -
user_group_grant_unique:CREATE UNIQUE INDEX user_group_grant_unique ON public.user_grant USING btree (group_id, role_id, scope_kind, COALESCE(scope_id, ''::text), scope_op) WHERE (group_id IS NOT NULL)