IF Commons GitHub

entitlement

concept

What a tenant may use, as distinct from what a principal may do

Model identityAccess. Written in commons/data/models/identity-access/concepts.ts:120. Identified by entitlementId.

Governance: attributes

entitlementIdidentifierrequired

What identifies the entitlement, made by the application

Becomes the column entitlement_id of entitlement.

Written at commons/data/models/identity-access/concepts.ts:123

featureKeytextrequired

The feature the tenant may use

Becomes the column feature_key of entitlement.

Written at commons/data/models/identity-access/concepts.ts:124

limitValueintegeroptional

How much of it, where it is limited

Becomes the column limit_value of entitlement.

Written at commons/data/models/identity-access/concepts.ts:125

sourcecode of entitlementSourcerequired

Where it comes from

Becomes the column entitlement_source_code of entitlement.

Written at commons/data/models/identity-access/concepts.ts:128

validFrominstantrequired

When it starts

Becomes the column valid_from of entitlement.

Written at commons/data/models/identity-access/concepts.ts:126

validToinstantoptional

When it ends, where it does

Becomes the column valid_to of entitlement.

Written at commons/data/models/identity-access/concepts.ts:127

Governance: relationships

tenantone

The tenant To tenant. Written at commons/data/models/identity-access/concepts.ts:120

Logical: the table

Projects to the table entitlement with the primary key entitlement_id.

ColumnTypeNullRoleFrom
entitlement_idtextfalseattributeentitlement.entitlementId
entitlement_source_codetextfalsereferenceentitlement.source
feature_keytextfalseattributeentitlement.featureKey
limit_valueintegertrueattributeentitlement.limitValue
tenant_idtextfalsereferenceentitlement.tenant
valid_fromtimestampfalseattributeentitlement.validFrom
valid_totimestamptrueattributeentitlement.validTo

Physical: SQL

CREATE TABLE IF NOT EXISTS "entitlement" (
    "entitlement_id" VARCHAR NOT NULL PRIMARY KEY,
    "feature_key" VARCHAR NOT NULL,
    "limit_value" INTEGER,
    "valid_from" TIMESTAMPTZ NOT NULL,
    "valid_to" TIMESTAMPTZ,
    "entitlement_source_code" VARCHAR NOT NULL,
    "tenant_id" VARCHAR NOT NULL,
    CONSTRAINT "entitlement_entitlement_source_code_fk" FOREIGN KEY ("entitlement_source_code") REFERENCES "entitlement_source" ("code"),
    CONSTRAINT "entitlement_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id")
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { entitlement } 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 { entitlement } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(entitlement).select((s) => ({ entitlementId: s.entitlement.entitlementId, featureKey: s.entitlement.featureKey })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.