ums

SystemSuite — Aggregate Architecture

Bounded Context: Authorization
Aggregate Root: SystemSuite
Module: Ums.Domain.Authorization.SystemSuite
Status: Production


1. Aggregate Overview

Purpose

The SystemSuite aggregate represents a tenant-owned application surface registered in UMS. It defines the functional topology used by downstream authorization models and stores suite-level operational settings. In the current implementation, it owns Module and AppSetting child entities and exposes a flat Action catalog for permission-template targeting.

Business Responsibility

Aggregate Root

SystemSuite is the aggregate root. Changes to suite identity, modules, app settings, and suite status must go through the aggregate root.

Invariants and Consistency Rules

  1. TenantId, Code, Name, and Description are mandatory.
  2. Code must be unique within the owning tenant boundary.
  3. Module.Code must be unique inside the suite.
  4. App settings cannot duplicate the same ConfigurationKey for the same ConfigurationScope.
  5. Module activation and deactivation are controlled through the parent aggregate.
  6. Actions referenced by downstream permission templates must belong to the suite topology governed by this aggregate.

| Entity / VO | Type | Ownership | Description | |—|—|—|—| | Module | Entity | Owned | Functional subsystem inside the suite | | AppSetting | Entity | Owned | Suite-scoped configuration entry | | Action | Entity | Owned / catalogued | Action tokens exposed for authorization targeting | | TenantId | Value Object | - | Tenant ownership boundary | | Code | Value Object | - | Technical identifier | | Name | Value Object | - | Display label | | Description | Value Object | - | Functional description | | SystemStatus | Enumeration | - | Active, Inactive, Beta, etc. |

Domain Events

| Event | Trigger | |—|—| | SystemSuiteRegisteredEvent | New suite created | | SystemSuiteStatusChangedEvent | Suite status changed | | SystemSuiteModuleAddedEvent | Module added | | SystemSuiteModuleRemovedEvent | Module removed | | SystemSuiteModuleStatusChangedEvent | Module activated or deactivated |


2. Domain Model

Classes / Entities / Value Objects

SystemSuite (Aggregate Root)
├── Props: SystemSuiteProps
│   ├── Id: IdValueObject
│   ├── TenantId: TenantId
│   ├── Code: Code
│   ├── Name: Name
│   ├── Description: Description
│   ├── Status: SystemStatus
│   └── Audit: AuditValueObject
├── Children
│   ├── IReadOnlyCollection<Module>
│   └── IReadOnlyCollection<AppSetting>
└── Catalog Surface
    └── IReadOnlyCollection<Action>

3. Object Model Diagrams

classDiagram
    direction TB
    class SystemSuite {
        +Guid Id
        +Guid TenantId
        +Code Code
        +Name Name
        +Description Description
        +SystemStatus Status
        +List~Module~ Modules
        +List~AppSetting~ AppSettings
        +List~Action~ Actions
        +Create(tenantId, code, name, description, actor)
        +Update(name, description, actor)
        +SetStatus(status, actor)
        +AddModule(code, name, description, sortOrder, actor)
        +UpdateModule(moduleId, name, description, sortOrder, actor)
        +ActivateModule(moduleId, actor)
        +DeactivateModule(moduleId, actor)
        +RemoveModule(moduleId, actor)
        +AddAppSetting(key, value, scope, actor)
    }
    class Module {
        +Guid Id
        +Guid SuiteId
        +Code Code
        +Name Name
        +Description Description
        +int SortOrder
        +ModuleStatus Status
    }
    class AppSetting {
        +Guid Id
        +ConfigurationKey Key
        +ConfigurationValue Value
        +ConfigurationScope Scope
    }
    class Action {
        +Guid Id
        +ActionCode Code
    }
    SystemSuite "1" *-- "0..*" Module
    SystemSuite "1" *-- "0..*" AppSetting
    SystemSuite "1" *-- "0..*" Action

4. Sequence Diagrams

Add Module Flow

sequenceDiagram
    participant C as Client
    participant H as Handler
    participant R as ISystemSuiteRepository
    participant S as SystemSuite (AR)

    C->>H: AddModuleCommand(systemSuiteId, code, name, description, sortOrder)
    H->>R: GetById(systemSuiteId)
    R-->>H: SystemSuite
    H->>S: AddModule(code, name, description, sortOrder, actor)
    S->>S: Validate module code uniqueness
    S->>S: Raise SystemSuiteModuleAddedEvent
    H->>R: Update(systemSuite)
    R-->>H: ok
    H-->>C: Success

5. ER Model

erDiagram
    TENANT ||--o{ SYSTEM_SUITE : "owns"
    SYSTEM_SUITE ||--o{ MODULE : "contains"
    SYSTEM_SUITE ||--o{ APP_SETTING : "defines"
    SYSTEM_SUITE ||--o{ ACTION : "exposes"

    SYSTEM_SUITE {
        uniqueidentifier Id PK
        uniqueidentifier TenantId FK
        nvarchar Code
        nvarchar Name
        nvarchar Description
        int StatusId
        nvarchar CreatedBy
        datetime2 CreatedAtUtc
        nvarchar UpdatedBy
        datetime2 UpdatedAtUtc
        nvarchar AuditTimeSpan
    }

Tenant Isolation Rules


6. Bounded Context Integration


7. Application Layer


8. Infrastructure/Persistence


9. Security & Compliance


10. Technical Decisions


Back to Authorization Index