šŸ“‘ SystemAccessList Class Documentation


šŸ“‹ Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Class Diagram (UML)
  4. Key Functional Areas
  5. Properties Reference
  6. Sample Code & Usage Examples
  7. Integration in a UI / ViewModel Scenario
  8. Error Handling & Return Types
  9. Conclusion

🧐 Overview & Purpose

The SystemAccessList class is a simple Data Model (POCO) used in the IrbyImaging UI layer. Its main role is to aggregate and transport detailed access‐control information across the application’s front end, combining:

  • Permissions (what operations are allowed),
  • Roles (predefined sets of permissions),
  • Employees (users assigned roles),
  • Departments, and
  • Ad‐Hoc Roles (temporary or specific assignment roles).

This unified model simplifies rendering user access lists in dashboards, grids, or reports within a WPF or ASP.NET MVC/Blazor UI.


šŸ› ļø Dependencies & Technologies

  • Language: C#
  • Platform: .NET (Core / Framework)
  • Namespace: IrbyImaging.UI.Models
  • Assemblies:
    • System (for Guid support)

No external NuGet packages or 3rd‐party integrations are directly referenced in this model.


šŸ“Š Class Diagram (UML)

classDiagram
    class SystemAccessList {
        +Guid PermissionId
        +string PermissionName
        +string PermissionDescription
        +Guid? RoleId
        +string RoleName
        +string RoleDescription
        +Guid EmployeeId
        +string EmployeeName
        +Guid? EmployeeRoleId
        +Guid? DepartmentId
        +string DepartmentName
        +Guid AdHocRoleId
        +string AdHocRoleName
        +string AdHocRoleDescription
    }

šŸš€ Key Functional Areas

  1. Permission Details

    • Stores unique PermissionId, human‐readable Name, and a Description.
  2. Role Assignment

    • Captures the user’s Role via an optional RoleId, its Name, and Description.
  3. Employee Context

    • Links to the EmployeeId (mandatory), Name, and any existing EmployeeRoleId.
  4. Department Association

    • Optionally ties an employee to a DepartmentId with its Name.
  5. Ad‑Hoc Role Handling

    • Separately tracks a special AdHocRoleId, Name, and Description to handle temporary or situational roles.

šŸ“‹ Properties Reference

Property Name Type Nullable Description
PermissionId Guid No Unique ID of the permission.
PermissionName string No Human‐readable name of the permission.
PermissionDescription string No Detailed info about what the permission allows.
RoleId Guid? Yes Optional ID of the role assigned to the user.
RoleName string No Role’s display name.
RoleDescription string No Summary of role’s responsibilities.
EmployeeId Guid No Unique ID for the employee.
EmployeeName string No Full name of the employee.
EmployeeRoleId Guid? Yes Specific role ID held by the employee (if any).
DepartmentId Guid? Yes ID of the department the employee belongs to.
DepartmentName string No Name of that department.
AdHocRoleId Guid No Unique ID for the ad‐hoc role.
AdHocRoleName string No Display name of the ad‐hoc role.
AdHocRoleDescription string No Details/notes about this ad‐hoc role assignment.

šŸ’» Sample Code & Usage Examples

Instantiating & Populating

using IrbyImaging.UI.Models;

var access = new SystemAccessList {
    PermissionId             = Guid.NewGuid(),
    PermissionName           = "EditImages",
    PermissionDescription    = "Allows user to modify image properties.",
    RoleId                   = Guid.Parse("a1b2c3d4-e5f6-7a8b-9c0d-e1f2a3b4c5d6"),
    RoleName                 = "ImageEditor",
    RoleDescription          = "Can edit and delete images.",
    EmployeeId               = Guid.Parse("11111111-2222-3333-4444-555555555555"),
    EmployeeName             = "Jane Doe",
    EmployeeRoleId           = Guid.Parse("a1b2c3d4-e5f6-7a8b-9c0d-e1f2a3b4c5d6"),
    DepartmentId             = Guid.Parse("66666666-7777-8888-9999-000000000000"),
    DepartmentName           = "Imaging Department",
    AdHocRoleId              = Guid.NewGuid(),
    AdHocRoleName            = "EmergencyAccess",
    AdHocRoleDescription     = "Temporary elevated access during an outage."
};

Rendering in a Razor View (ASP.NET MVC / Blazor)

<table class="table">
  <thead>
    <tr>
      <th>Employee</th><th>Role</th><th>Permission</th><th>Dept.</th><th>Ad-Hoc Role</th>
    </tr>
  </thead>
  <tbody>
    @foreach(var item in Model.SystemAccessLists) {
      <tr>
        <td>@item.EmployeeName</td>
        <td>@item.RoleName</td>
        <td>@item.PermissionName</td>
        <td>@item.DepartmentName</td>
        <td>@item.AdHocRoleName</td>
      </tr>
    }
  </tbody>
</table>

šŸ”— Integration in a UI / ViewModel Scenario

  1. Controller / ViewModel

    • Query your data store for permissions, roles, employees, etc.
    • Map results into a list of SystemAccessList.
  2. Binding to View

    • Pass the list as a model or part of a larger view model.
    • The front‐end uses the properties to display a comprehensive access matrix.
  3. Filtering & Sorting

    • Use LINQ on IEnumerable<SystemAccessList> for client‐side filtering (by department, role, etc.).

āš ļø Error Handling & Return Types

  • This model has no methods; error handling is managed upstream.
  • Nullability on Guid? fields enables safe absence of data (e.g., no RoleId means no role assigned).
  • When consuming:
    • Always check for null on optional fields.
    • Wrap view rendering in guards to avoid null‐reference issues.

āœ… Conclusion

The SystemAccessList class is a versatile, flat DTO that unifies multiple aspects of system‐access data for UI rendering. It is:

  • Easy to Map from database records or domain entities
  • Lightweight and Framework‐agnostic
  • Ideal for displaying user‐permission matrices, audit logs, or administrative dashboards

With this model in place, you can rapidly implement comprehensive access management views in any .NET web or desktop UI. Enjoy building your next access‐control feature! šŸŽ‰


Generated by IrbyImaging Documentation Generator