IF Commons GitHub

principalAttribute

concept

A value of an attribute for a principal of any kind

Model identityAbac. Written in commons/data/models/identity-abac/mod.ts:53. Identified by principal, definition.

Governance: attributes

updatedAtinstantrequired

When it was last asserted

Becomes the column updated_at of principal_attribute.

Written at commons/data/models/identity-abac/mod.ts:59

validFrominstantrequired

When the value starts to hold

Becomes the column valid_from of principal_attribute.

Written at commons/data/models/identity-abac/mod.ts:57

validToinstantoptional

When it stops, where it does

Becomes the column valid_to of principal_attribute.

Written at commons/data/models/identity-abac/mod.ts:58

valuestructuredrequired

The value, of the type the definition says

Becomes the column value of principal_attribute.

Written at commons/data/models/identity-abac/mod.ts:56

Governance: relationships

assertedByoptional

Who asserted it, where a principal did To principal. Written at commons/data/models/identity-abac/mod.ts:65

definitionone

The attribute To attributeDefinition. Written at commons/data/models/identity-abac/mod.ts:54

principalone

The principal To principal. Written at commons/data/models/identity-abac/mod.ts:63

Logical: the table

Projects to the table principal_attribute with the primary key principal_id, definition_attribute_definition_id.

ColumnTypeNullRoleFrom
asserted_by_principal_idtexttruereferenceprincipalAttribute.assertedBy
definition_attribute_definition_idtextfalsereferenceprincipalAttribute.definition
principal_idtextfalsereferenceprincipalAttribute.principal
updated_attimestampfalseattributeprincipalAttribute.updatedAt
valid_fromtimestampfalseattributeprincipalAttribute.validFrom
valid_totimestamptrueattributeprincipalAttribute.validTo
valuejsonfalseattributeprincipalAttribute.value

Physical: SQL

CREATE TABLE IF NOT EXISTS "principal_attribute" (
    "principal_id" VARCHAR NOT NULL,
    "definition_attribute_definition_id" VARCHAR NOT NULL,
    "value" JSON NOT NULL,
    "valid_from" TIMESTAMPTZ NOT NULL,
    "valid_to" TIMESTAMPTZ,
    "updated_at" TIMESTAMPTZ NOT NULL,
    "asserted_by_principal_id" VARCHAR,
    PRIMARY KEY ("principal_id", "definition_attribute_definition_id"),
    CONSTRAINT "principal_attribute_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "principal_attribute_definition_attribute_definition_id_fk" FOREIGN KEY ("definition_attribute_definition_id") REFERENCES "attribute_definition" ("attribute_definition_id"),
    CONSTRAINT "principal_attribute_asserted_by_principal_id_fk" FOREIGN KEY ("asserted_by_principal_id") REFERENCES "principal" ("principal_id")
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { principalAttribute } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-abac.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { principalAttribute } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(principalAttribute).select((s) => ({ principalId: s.principalAttribute.principalId, definitionAttributeDefinitionId: s.principalAttribute.definitionAttributeDefinitionId })).run(runner);

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