Giao diện
Danh tính & Phân quyền
Trang sinh tự động
Phần nghiệp vụ viết tay; API, dữ liệu, quyền, đường dẫn và file nguồn do bộ sinh điền từ source tại ad83b0aea.
Làm gì
Tài khoản, phiên, mật khẩu và MFA đều của PIDEAL (không dùng Supabase Auth). Một khách hàng có một tài khoản CUSTOMER với membership theo từng app; nhân viên Web Admin là tài khoản STAFF riêng. Phân quyền theo vai trò với phạm vi, đổi vai trò luôn qua maker/checker.
Quy mô
| Domain API | identity, mfa, profile |
| Query / Mutation | 12 / 16 |
| Nguồn dữ liệu | identity |
| Bảng | 49 |
| Luật phân quyền | 9 |
| Đường dẫn Web Admin | 12 |
Thao tác (mutation)
| Mutation | Domain | Mô tả |
|---|---|---|
approveMembership | identity | PENDING -> ACTIVE for a WEB_ADMIN membership; grants no role (the person |
approveMfaReset | mfa | A different person approves and executes it: factor removed, grants revoked, sessions ended (AD-04, MFA). |
approveRoleChange | identity | Checker approves and applies someone else's change (AD-02, MFA); never its maker (same person), super_admin only by a super_admin. |
assignRole | identity | Files a WEB_ADMIN role grant for another staff member (AD-01 maker, MFA). |
createRole | identity | New custom WEB_ADMIN role with no grant (RB-03, MFA step-up). |
createStaffAccount | identity | Creates a STAFF account, its WEB_ADMIN membership ACTIVE (it can sign in; |
deleteAddress | profile | Requires profile.manage. Soft-deletes one non-default address. |
rejectMembership | identity | Rejects a new staff member (PPI-P7-01): every PENDING role request of the |
requestMfaReset | mfa | Opens an MFA reset case for another staff member (AD-03 maker, MFA step-up). |
revokeRole | identity | Files a role revocation for another staff member (AD-01 maker, MFA). |
saveAddress | profile | Requires profile.manage. Adds or replaces one of the caller's addresses. PAF: at most 10 addresses; a new 11th is refused with extensions.reason address_book_full (editing an existing one still works). |
setAccountStatus | identity | Account-wide status with a reason. No matrix rule yet: denied. |
setMembershipStatus | identity | Lock/unlock WEB_ADMIN access with a reason. No matrix rule yet: denied. |
setRolePermissions | identity | Files a grant-set change of a custom role (AD-01 maker, MFA); applied on approval. |
updateMe | profile | Requires profile.manage. Saves the caller's own profile. A Sale (or any |
updateRole | identity | Rename/describe a custom role; new version (RB-03, MFA step-up). |
Phép đọc (query)
| Query | Domain | Mô tả |
|---|---|---|
addressProvinces | profile | Requires profile.manage. The Province / City catalogue (34 units) for the |
me | identity | The caller. Works while PENDING (that is what the waiting screen reads). |
myAddresses | profile | Requires profile.manage. The caller's live addresses, default first. |
pendingAccounts | identity | Approval queue: PENDING WEB_ADMIN registrations, oldest first. Requires staff.read (AD-05). |
permissions | identity | Permission catalog grouped by resource. RB-01/RB-02. |
role | identity | One role by app (default WEB_ADMIN) and code. RB-01/RB-02. |
roleChangeRequests | identity | Maker/checker queue, oldest first. RB-01/RB-02. |
roleHistory | identity | Every recorded version of a role, oldest first. RB-01/RB-02. |
roles | identity | Role catalog with live grants. Requires role_permission.manage/approve (RB-01/RB-02). |
staff | identity | WEB_ADMIN staff, masked. Requires staff.read (AD-05). |
staffAccounts | identity | STAFF accounts with their credential and pending role request, masked, |
staffDetail | identity | One staff member, masked. Requires staff.read (AD-05). |
Dữ liệu
- Domain
identity— 49 bảng, 12 nhóm con: sale (10) · role (5) · privacy (4) · mfa (3) · account (2) · audit (2) · consent (2) · legal (2) · media (2) · pipoint (2) · sign (2) · bảng đơn lẻ (13) (13)
Bảng được tham chiếu nhiều nhất trong module:
| Bảng | Cột | Được trỏ tới | RLS |
|---|---|---|---|
accounts | 12 | 240 | ✓ |
media | 23 | 15 | ✓ |
app_memberships | 10 | 12 | ✓ |
roles | 9 | 4 | ✓ |
privacy_requests | 17 | 3 | ✓ |
role_assignments | 14 | 3 | ✓ |
sale_applications | 13 | 3 | ✓ |
sale_teams | 12 | 3 | ✓ |
mfa_factors | 17 | 2 | ✓ |
retention_policies | 10 | 2 | ✓ |
Quyền
| Mã | Quyền | Ứng dụng | Vai trò | Phạm vi | Trạng thái |
|---|---|---|---|---|---|
A-01 | auth.register | APP_USER, APP_SALE | anonymous | PUBLIC | DEFINED |
A-02 | auth.sign_in | APP_USER, APP_SALE, WEB_ADMIN | anonymous | PUBLIC | DEFINED |
A-03 | auth.password_reset | APP_USER, APP_SALE | anonymous | PUBLIC | DEFINED |
AD-05 | staff.read | WEB_ADMIN | admin super_admin | ALL | PROPOSED |
AD-09 | staff.create | WEB_ADMIN | admin super_admin | ALL | PROPOSED |
AD-10 | staff.credential_issue | WEB_ADMIN | admin super_admin | ALL | PROPOSED |
RB-01 | role_permission.manage | WEB_ADMIN | admin | ALL | PROPOSED |
RB-02 | role_permission.approve | WEB_ADMIN | super_admin | ALL | PROPOSED |
RB-03 | role_permission.manage | WEB_ADMIN | admin | ALL | PROPOSED |
Danh sách đầy đủ và cách đọc các cờ: Ma trận quyền.
Giao diện Web Admin
| Đường dẫn | Hằng số |
|---|---|
/mfa/enroll | MFA_ENROLL |
/mfa/recovery | MFA_RECOVERY |
/permissions | PERMISSIONS |
/profile | PROFILE |
/profile/mfa | MFA_STATUS |
/profile/mfa/resets | MFA_RESETS |
/profile/password | PROFILE_PASSWORD |
/profile/security | PROFILE_SECURITY |
/roles | ROLES |
/roles/:code | ROLE_DETAIL |
/roles/:code/edit | ROLE_EDIT |
/roles/new | ROLE_NEW |
File nguồn
Backend:
code/apps/api/supabase/functions/graphql/domains/identity/code/apps/api/supabase/functions/graphql/domains/mfa/code/apps/api/supabase/functions/graphql/domains/profile/
Dữ liệu: bảng thuộc domain identity — xem Cơ sở dữ liệu.
Tài nguyên quyền không có luật nào
Bản đồ module khai các tài nguyên account, permission, mfa nhưng ma trận quyền không có luật nào cho chúng. Hoặc tên tài nguyên trong bản đồ sai, hoặc quyền chưa được định nghĩa.