Bounded Context: Authorization
Aggregate Root: Role
Module: Ums.Domain.Authorization.Role
Status: Production
Role is the tenant-scoped master catalog of responsibilities defined by a SystemSuite. It supplies the governed role identifier referenced by permission templates and profiles, while supporting an optional hierarchy for promotion and administration.
| Field | Rule |
|---|---|
Code |
Required and unique within SystemSuiteId; stable machine code. |
Value |
Required display value used by administrators. |
Description |
Functional explanation maintained with the catalog item. |
ParentRoleId |
Optional role in the same system suite. |
HierarchyLevel |
Root is 0; child is parent level plus one. |
PromotionOrder |
Non-negative order used by role governance flows. |
IsActive |
Lifecycle state; inactive records remain auditable. |
TenantIdandSystemSuiteIdare mandatory ownership boundaries.- A role code cannot be repeated in a system suite.
- A parent role must belong to the same system suite.
- Role parent relationships cannot form cycles.
- Role operations return
Resultfailures for business conditions; they do not use exceptions for flow control.
classDiagram
class SystemSuite {
+Guid Id
}
class Role {
+Guid Id
+Guid TenantId
+Guid SystemSuiteId
+Guid ParentRoleId
+Code Code
+Name Value
+Description Description
+int HierarchyLevel
+int PromotionOrder
+bool IsActive
+Create()
+Update()
+Activate()
+Deactivate()
}
SystemSuite "1" --> "0..*" Role : defines
Role "0..1" --> "0..*" Role : parentOf
- Commands: REST
POST /system-suites/{systemSuiteId}/roles,PUT /system-suites/{systemSuiteId}/roles/{roleId}, and status endpoints. - Query: GraphQL
rolesBySystemSuite(systemSuiteId). - User interface: the
Rolestab belongs to the selected System Suite detail panel. - User-safe failures identify the corrective cause and expose
ErrorIdfor support; stack traces and implementation details are logged only through Serilog/Loki.
- SQL Server table:
[ums_authorization].[Roles]. - Application query filters constrain records by
TenantId; SQL Server safeguards are secondary controls. - FKs enforce suite ownership and optional self-parent linkage.