delegationIdidentifierrequiredWhat identifies the delegation, made by the application
Becomes the column delegation_id of delegation.
Written at commons/data/models/identity-delegation/mod.ts:24
One principal acting on behalf of another, for a time and for some permissions, never more than the one above it
Model identityDelegation. Written in commons/data/models/identity-delegation/mod.ts:21. Identified by delegationId.
delegationIdidentifierrequiredWhat identifies the delegation, made by the application
Becomes the column delegation_id of delegation.
Written at commons/data/models/identity-delegation/mod.ts:24
depthintegerrequiredHow many delegations are above it: none for the first
Becomes the column depth of delegation.
Written at commons/data/models/identity-delegation/mod.ts:25
expiresAtinstantrequiredWhen it ends: a delegation always ends, and never after the one above it
Becomes the column expires_at of delegation.
Written at commons/data/models/identity-delegation/mod.ts:34
expressiontextoptionalAn extra condition; the conditions of the delegations above it hold too, so a delegation can only add
Becomes the column expression of delegation.
Written at commons/data/models/identity-delegation/mod.ts:29
expressionLanguagecode of expressionLanguageoptionalThe language of the condition
Becomes the column expression_language_code of delegation.
Written at commons/data/models/identity-delegation/mod.ts:30
maxDepthintegerrequiredHow many more delegations may be added below it; less than the one above it
Becomes the column max_depth of delegation.
Written at commons/data/models/identity-delegation/mod.ts:32
purposetextrequiredWhat it is for
Becomes the column purpose of delegation.
Written at commons/data/models/identity-delegation/mod.ts:26
redelegablebooleanrequiredWhether the delegate may pass it on
Becomes the column redelegable of delegation.
Written at commons/data/models/identity-delegation/mod.ts:31
resourceIdtextoptionalThe resource it is limited to: exact, or a prefix ending `*`
Becomes the column resource_id of delegation.
Written at commons/data/models/identity-delegation/mod.ts:28
resourceTypetextoptionalThe kind of the one resource it is limited to
Becomes the column resource_type of delegation.
Written at commons/data/models/identity-delegation/mod.ts:27
revokeReasontextoptionalWhy it was ended early
Becomes the column revoke_reason of delegation.
Written at commons/data/models/identity-delegation/mod.ts:37
revokedAtinstantoptionalWhen it was ended early
Becomes the column revoked_at of delegation.
Written at commons/data/models/identity-delegation/mod.ts:36
statuscode of delegationStatusrequiredWhere it is
Becomes the column status of delegation.
Annotations: quality.transitions={"allowed":{"active":["revoked","expired"],"revoked":[],"expired":[]}}
Written at commons/data/models/identity-delegation/mod.ts:35
validFrominstantrequiredWhen it starts
Becomes the column valid_from of delegation.
Written at commons/data/models/identity-delegation/mod.ts:33
delegateoneWho acts on their behalf To principal. Written at commons/data/models/identity-delegation/mod.ts:43
delegatoroneWho passes on what they hold To principal. Written at commons/data/models/identity-delegation/mod.ts:42
parentoptionalThe delegation it was made under, where it was made under one To delegation. Written at commons/data/models/identity-delegation/mod.ts:44
revokedByoptionalWho ended it early To principal. Written at commons/data/models/identity-delegation/mod.ts:46
rootoptionalThe first delegation of the chain, where it is not itself the first To delegation. Written at commons/data/models/identity-delegation/mod.ts:45
tenantoneThe tenant it is in To tenant. Written at commons/data/models/identity-delegation/mod.ts:41
Projects to the table delegation with the primary key delegation_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
delegate_principal_id | text | false | reference | delegation.delegate |
delegation_id | text | false | attribute | delegation.delegationId |
delegator_principal_id | text | false | reference | delegation.delegator |
depth | integer | false | attribute | delegation.depth |
expires_at | timestamp | false | attribute | delegation.expiresAt |
expression | text | true | attribute | delegation.expression |
expression_language_code | text | true | reference | delegation.expressionLanguage |
max_depth | integer | false | attribute | delegation.maxDepth |
parent_delegation_id | text | true | reference | delegation.parent |
purpose | text | false | attribute | delegation.purpose |
redelegable | boolean | false | attribute | delegation.redelegable |
resource_id | text | true | attribute | delegation.resourceId |
resource_type | text | true | attribute | delegation.resourceType |
revoke_reason | text | true | attribute | delegation.revokeReason |
revoked_at | timestamp | true | attribute | delegation.revokedAt |
revoked_by_principal_id | text | true | reference | delegation.revokedBy |
root_delegation_id | text | true | reference | delegation.root |
status | text | false | attribute | delegation.status |
tenant_id | text | false | reference | delegation.tenant |
valid_from | timestamp | false | attribute | delegation.validFrom |
CREATE TABLE IF NOT EXISTS "delegation" (
"delegation_id" VARCHAR NOT NULL PRIMARY KEY,
"depth" INTEGER NOT NULL,
"purpose" VARCHAR NOT NULL,
"resource_type" VARCHAR,
"resource_id" VARCHAR,
"expression" VARCHAR,
"expression_language_code" VARCHAR,
"redelegable" BOOLEAN NOT NULL,
"max_depth" INTEGER NOT NULL,
"valid_from" TIMESTAMPTZ NOT NULL,
"expires_at" TIMESTAMPTZ NOT NULL,
"status" VARCHAR NOT NULL,
"revoked_at" TIMESTAMPTZ,
"revoke_reason" VARCHAR,
"tenant_id" VARCHAR NOT NULL,
"delegator_principal_id" VARCHAR NOT NULL,
"delegate_principal_id" VARCHAR NOT NULL,
"parent_delegation_id" VARCHAR,
"root_delegation_id" VARCHAR,
"revoked_by_principal_id" VARCHAR,
CONSTRAINT "delegation_expression_language_code_fk" FOREIGN KEY ("expression_language_code") REFERENCES "expression_language" ("code"),
CONSTRAINT "delegation_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "delegation_delegator_principal_id_fk" FOREIGN KEY ("delegator_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_delegate_principal_id_fk" FOREIGN KEY ("delegate_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_parent_delegation_id_fk" FOREIGN KEY ("parent_delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "delegation_root_delegation_id_fk" FOREIGN KEY ("root_delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "delegation_revoked_by_principal_id_fk" FOREIGN KEY ("revoked_by_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_status_ck" CHECK ("status" IN ('active', 'revoked', 'expired')),
CONSTRAINT "delegation_delegator_not_delegate_ck" CHECK ("delegator_principal_id" <> "delegate_principal_id")
);CREATE TABLE IF NOT EXISTS "delegation" (
"delegation_id" TEXT NOT NULL PRIMARY KEY,
"depth" INTEGER NOT NULL,
"purpose" TEXT NOT NULL,
"resource_type" TEXT,
"resource_id" TEXT,
"expression" TEXT,
"expression_language_code" TEXT,
"redelegable" BOOLEAN NOT NULL,
"max_depth" INTEGER NOT NULL,
"valid_from" TIMESTAMPTZ NOT NULL,
"expires_at" TIMESTAMPTZ NOT NULL,
"status" TEXT NOT NULL,
"revoked_at" TIMESTAMPTZ,
"revoke_reason" TEXT,
"tenant_id" TEXT NOT NULL,
"delegator_principal_id" TEXT NOT NULL,
"delegate_principal_id" TEXT NOT NULL,
"parent_delegation_id" TEXT,
"root_delegation_id" TEXT,
"revoked_by_principal_id" TEXT,
CONSTRAINT "delegation_expression_language_code_fk" FOREIGN KEY ("expression_language_code") REFERENCES "expression_language" ("code"),
CONSTRAINT "delegation_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "delegation_delegator_principal_id_fk" FOREIGN KEY ("delegator_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_delegate_principal_id_fk" FOREIGN KEY ("delegate_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_parent_delegation_id_fk" FOREIGN KEY ("parent_delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "delegation_root_delegation_id_fk" FOREIGN KEY ("root_delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "delegation_revoked_by_principal_id_fk" FOREIGN KEY ("revoked_by_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_status_ck" CHECK ("status" IN ('active', 'revoked', 'expired')),
CONSTRAINT "delegation_delegator_not_delegate_ck" CHECK ("delegator_principal_id" <> "delegate_principal_id")
);CREATE TABLE IF NOT EXISTS "delegation" (
"delegation_id" TEXT NOT NULL PRIMARY KEY,
"depth" INTEGER NOT NULL,
"purpose" TEXT NOT NULL,
"resource_type" TEXT,
"resource_id" TEXT,
"expression" TEXT,
"expression_language_code" TEXT,
"redelegable" INTEGER NOT NULL,
"max_depth" INTEGER NOT NULL,
"valid_from" TEXT NOT NULL,
"expires_at" TEXT NOT NULL,
"status" TEXT NOT NULL,
"revoked_at" TEXT,
"revoke_reason" TEXT,
"tenant_id" TEXT NOT NULL,
"delegator_principal_id" TEXT NOT NULL,
"delegate_principal_id" TEXT NOT NULL,
"parent_delegation_id" TEXT,
"root_delegation_id" TEXT,
"revoked_by_principal_id" TEXT,
CONSTRAINT "delegation_expression_language_code_fk" FOREIGN KEY ("expression_language_code") REFERENCES "expression_language" ("code"),
CONSTRAINT "delegation_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "delegation_delegator_principal_id_fk" FOREIGN KEY ("delegator_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_delegate_principal_id_fk" FOREIGN KEY ("delegate_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_parent_delegation_id_fk" FOREIGN KEY ("parent_delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "delegation_root_delegation_id_fk" FOREIGN KEY ("root_delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "delegation_revoked_by_principal_id_fk" FOREIGN KEY ("revoked_by_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "delegation_status_ck" CHECK ("status" IN ('active', 'revoked', 'expired')),
CONSTRAINT "delegation_delegator_not_delegate_ck" CHECK ("delegator_principal_id" <> "delegate_principal_id")
);Read and written from TypeScript with the types the model gives: import { delegation } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-delegation.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { delegation } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(delegation).select((s) => ({ delegationId: s.delegation.delegationId, depth: s.delegation.depth })).run(runner);