Kaizen
Browse modulesAccessaccess/sharedFunctions

Function: scopeKeyOf()

function scopeKeyOf(scope: GrantScope): string;

Defined in: shared/access/scope-key.ts:12

Normalize a scope into the scopeKey string stored on rbac_grants and rbac_subject_grant_version: "organization:<orgId>" or "platform".

The unique constraint and the per-subject grant-version counter are keyed on this (not the nullable organizationId) because Postgres treats NULLs as distinct — keying on the nullable column would fail to dedupe platform grants. Keep this the single source of the key format.

Parameters

ParameterType
scopeGrantScope

Returns

string

On this page