Architecture
Docs/Architecture
Tài liệu sống được đồng bộ theo codebase hiện tại.

Tenant Model

Hierarchy User → Organization → Workspace → Website.

Hierarchy chuẩn

User
  -> Organization
    -> Workspace
      -> Website

Ý nghĩa từng lớp

LayerÝ nghĩa
Userglobal identity
Organizationaccount + billing boundary
Workspacepermission + enablement boundary
Websitepublic runtime boundary

Quy tắc authorization

  1. Tenant access đi từ membership hoặc ownership.
  2. workspaceId chỉ chọn context, không tự tạo quyền.
  3. Support access chỉ hợp lệ nếu có support session runtime.
  4. Feature gating cần đi qua entitlement thật ở backend.

Điều cần nhớ khi code

  • users.roleId không thay thế được tenant membership.
  • Scope query ở repository/service trước, không đẩy xuống UI.