IF Commons GitHub

userGroup

concept

A set of principals that is granted what its members are

Model identity. Written in commons/data/models/identity/concepts.ts:113. Identified by principal.

Governance: attributes

externalIdtextoptional

What a directory calls the group, where it keeps it

Becomes the column external_id of user_group.

Written at commons/data/models/identity/concepts.ts:118

nametextrequired

What the group is called, unique within its tenant

Becomes the column name of user_group.

Written at commons/data/models/identity/concepts.ts:116

sourcecode of groupSourcerequired

Where the group is kept

Becomes the column source of user_group.

Written at commons/data/models/identity/concepts.ts:117

Governance: relationships

principalone

The principal the group is To principal. Written at commons/data/models/identity/concepts.ts:225

tenantone

The tenant the group is in To tenant. Written at commons/data/models/identity/concepts.ts:286

Logical: the table

Projects to the table user_group with the primary key principal_id.

ColumnTypeNullRoleFrom
external_idtexttrueattributeuserGroup.externalId
nametextfalseattributeuserGroup.name
principal_idtextfalsereferenceuserGroup.principal
sourcetextfalseattributeuserGroup.source
tenant_idtextfalsereferenceuserGroup.tenant

Physical: SQL

CREATE TABLE IF NOT EXISTS "user_group" (
    "principal_id" VARCHAR NOT NULL PRIMARY KEY,
    "name" VARCHAR NOT NULL,
    "source" VARCHAR NOT NULL,
    "external_id" VARCHAR,
    "tenant_id" VARCHAR NOT NULL,
    CONSTRAINT "user_group_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "user_group_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
    CONSTRAINT "user_group_tenant_id_name_uq" UNIQUE ("tenant_id", "name"),
    CONSTRAINT "user_group_source_ck" CHECK ("source" IN ('local', 'directory'))
);

Physical: the typed table

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

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

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

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