Skip to content

identity / role ​

Trang sinh tự động

Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.

5 bảng. Quay lại identity.

roles ​

Chưa có mô tả — bảng này chưa có COMMENT ON TABLE.

public.roles · 9 cột · 3 check · 2 unique · 3 index · 1 policy · 4 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
appapp_codeNOT NULL
codetextNOT NULL
nametextNOT NULL
descriptiontext
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL
is_systembooleanNOT NULLP1-06. PD-08 s14 baseline role seeded from the permission matrix; immutable through the API.

Khoá chính: id

Trỏ ra: không có

Được trỏ tới (4): role_assignments, role_change_requests, role_permission_grants, role_versions

role_assignments ​

Chưa có mô tả — bảng này chưa có COMMENT ON TABLE.

public.role_assignments · 14 cột · 5 check · 0 unique · 3 index · 1 policy · 5 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
account_iduuidNOT NULLFK → app_memberships
appapp_codeNOT NULLFK → roles
role_iduuidNOT NULLFK → roles
granted_byuuidNOT NULLFK → accounts
approved_byuuidFK → accounts
grant_reasontextNOT NULL
granted_attimestamptzNOT NULL
revoked_attimestamptz
revoked_byuuidFK → accounts
revoke_reasontext
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL

Khoá chính: id

Trỏ ra (5):

  • approved_by → accounts · ON DELETE RESTRICT
  • granted_by → accounts · ON DELETE RESTRICT
  • account_id, app → app_memberships · ON DELETE RESTRICT
  • revoked_by → accounts · ON DELETE RESTRICT
  • role_id, app → roles · ON DELETE RESTRICT

Được trỏ tới (3): rbac_bootstrap_runs, rbac_bootstrap_runs, role_change_requests

role_change_requests ​

P1-06. Maker/checker RBAC changes (AD-01 request, AD-02 approve). PENDING -> APPROVED once; payload immutable.

public.role_change_requests · 22 cột · 13 check · 0 unique · 4 index · 0 policy · 6 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
kindtextNOT NULL
appapp_codeNOT NULLFK → app_memberships
role_iduuidNOT NULLFK → roles
role_versionintegerNOT NULL
account_iduuidFK → app_memberships
assignment_iduuidFK → role_assignments
grantsjsonb
payload_hashtextNOT NULL
reasontextNOT NULL
statustextNOT NULL
requested_byuuidNOT NULLFK → accounts
requested_attimestamptzNOT NULL
approved_byuuidFK → accounts
approved_attimestamptz
applied_versioninteger
correlation_idcorrelation_ref
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL
rejected_byuuidFK → accountsPPI-P7-01. Who rejected the request (rejectMembership of a new staff member); never the maker nor the person.
rejected_attimestamptz

Khoá chính: id

Trỏ ra (6):

  • approved_by → accounts · ON DELETE RESTRICT
  • assignment_id → role_assignments · ON DELETE RESTRICT
  • rejected_by → accounts · ON DELETE RESTRICT
  • requested_by → accounts · ON DELETE RESTRICT
  • role_id, app → roles · ON DELETE RESTRICT
  • account_id, app → app_memberships · ON DELETE RESTRICT

Được trỏ tới (2): role_permission_grants, role_versions

role_versions ​

P1-06. APPEND_ONLY snapshot of every role version (name/description/system flag, who, which request).

public.role_versions · 11 cột · 1 check · 0 unique · 1 index · 0 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
role_iduuidNOT NULLPK FK → roles
versionintegerNOT NULLPK
appapp_codeNOT NULL
codetextNOT NULL
nametextNOT NULL
descriptiontext
is_systembooleanNOT NULL
changed_byuuidFK → accounts
change_request_iduuidFK → role_change_requests
recorded_attimestamptzNOT NULL
recorded_xactxid8NOT NULL

Khoá chính: role_id, version

Trỏ ra (3):

  • change_request_id → role_change_requests · ON DELETE RESTRICT
  • changed_by → accounts · ON DELETE RESTRICT
  • role_id → roles · ON DELETE RESTRICT

Được trỏ tới (2): role_permission_grants, role_permission_grants

role_permission_grants ​

P1-06. Role -> permission + scope, as intervals over role versions. Live = revoked_in_version IS NULL.

public.role_permission_grants · 10 cột · 4 check · 0 unique · 3 index · 0 policy · 6 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
role_iduuidNOT NULLFK → roles
permission_iduuidNOT NULLFK → permissions
scopetextNOT NULL
granted_in_versionintegerNOT NULLFK → role_versions
revoked_in_versionintegerFK → role_versions
origintextNOT NULL
matrix_rule_idstext[]NOT NULL
change_request_iduuidFK → role_change_requests
created_attimestamptzNOT NULL

Khoá chính: id

Trỏ ra (5):

  • change_request_id → role_change_requests · ON DELETE RESTRICT
  • role_id, granted_in_version → role_versions · ON DELETE RESTRICT
  • permission_id → permissions · ON DELETE RESTRICT
  • role_id, revoked_in_version → role_versions · ON DELETE RESTRICT
  • role_id → roles · ON DELETE RESTRICT

Được trỏ tới: không có

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17