appliesTocode of principalKindmanyThe kinds of principal that may hold it; every kind where none is said
Becomes the column applies_to of permission.
Written at commons/data/models/identity-access/concepts.ts:27
A thing that can be done, named by its resource and its action
Model identityAccess. Written in commons/data/models/identity-access/concepts.ts:18. Identified by permissionId.
appliesTocode of principalKindmanyThe kinds of principal that may hold it; every kind where none is said
Becomes the column applies_to of permission.
Written at commons/data/models/identity-access/concepts.ts:27
definitiontextrequiredWhat the permission lets a principal do
Becomes the column definition of permission.
Written at commons/data/models/identity-access/concepts.ts:19
featureKeytextoptionalThe feature a tenant must be entitled to for the permission to count
Becomes the column feature_key of permission.
Written at commons/data/models/identity-access/concepts.ts:28
ownerModuletextrequiredThe module that registered the permission
Becomes the column owner_module of permission.
Written at commons/data/models/identity-access/concepts.ts:24
permissionIdidentifierrequiredWhat identifies the permission, made by the application
Becomes the column permission_id of permission.
Written at commons/data/models/identity-access/concepts.ts:21
permissionKeytextrequiredThe permission as `resource:action`, unique
Becomes the column permission_key of permission.
Written at commons/data/models/identity-access/concepts.ts:22
riskLevelcode of riskLevelrequiredHow much harm it can do if it is misused
Becomes the column risk_level of permission.
Written at commons/data/models/identity-access/concepts.ts:25
sideEffectcode of sideEffectrequiredWhat using it does
Becomes the column side_effect of permission.
Written at commons/data/models/identity-access/concepts.ts:26
Projects to the table permission with the primary key permission_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
definition | text | false | attribute | permission.definition |
feature_key | text | true | attribute | permission.featureKey |
owner_module | text | false | attribute | permission.ownerModule |
permission_id | text | false | attribute | permission.permissionId |
permission_key | text | false | attribute | permission.permissionKey |
risk_level | text | false | attribute | permission.riskLevel |
side_effect | text | false | attribute | permission.sideEffect |
CREATE TABLE IF NOT EXISTS "permission" (
"permission_id" VARCHAR NOT NULL PRIMARY KEY,
"permission_key" VARCHAR NOT NULL,
"definition" VARCHAR NOT NULL,
"owner_module" VARCHAR NOT NULL,
"risk_level" VARCHAR NOT NULL,
"side_effect" VARCHAR NOT NULL,
"feature_key" VARCHAR,
CONSTRAINT "permission_permission_key_uq" UNIQUE ("permission_key"),
CONSTRAINT "permission_risk_level_ck" CHECK ("risk_level" IN ('low', 'medium', 'high', 'critical')),
CONSTRAINT "permission_side_effect_ck" CHECK ("side_effect" IN ('none', 'read', 'write', 'external', 'irreversible'))
);CREATE TABLE IF NOT EXISTS "permission" (
"permission_id" TEXT NOT NULL PRIMARY KEY,
"permission_key" TEXT NOT NULL,
"definition" TEXT NOT NULL,
"owner_module" TEXT NOT NULL,
"risk_level" TEXT NOT NULL,
"side_effect" TEXT NOT NULL,
"feature_key" TEXT,
CONSTRAINT "permission_permission_key_uq" UNIQUE ("permission_key"),
CONSTRAINT "permission_risk_level_ck" CHECK ("risk_level" IN ('low', 'medium', 'high', 'critical')),
CONSTRAINT "permission_side_effect_ck" CHECK ("side_effect" IN ('none', 'read', 'write', 'external', 'irreversible'))
);CREATE TABLE IF NOT EXISTS "permission" (
"permission_id" TEXT NOT NULL PRIMARY KEY,
"permission_key" TEXT NOT NULL,
"definition" TEXT NOT NULL,
"owner_module" TEXT NOT NULL,
"risk_level" TEXT NOT NULL,
"side_effect" TEXT NOT NULL,
"feature_key" TEXT,
CONSTRAINT "permission_permission_key_uq" UNIQUE ("permission_key"),
CONSTRAINT "permission_risk_level_ck" CHECK ("risk_level" IN ('low', 'medium', 'high', 'critical')),
CONSTRAINT "permission_side_effect_ck" CHECK ("side_effect" IN ('none', 'read', 'write', 'external', 'irreversible'))
);Read and written from TypeScript with the types the model gives: import { permission } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-access.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { permission } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(permission).select((s) => ({ permissionId: s.permission.permissionId, permissionKey: s.permission.permissionKey })).run(runner);