T4 — Use Case Diagram - congsinhv/fluxion GitHub Wiki

Use Case Diagram — Fluxion MDM

Numbering chính thức: Mục 3.3 theo Master TOC

Issue: #22 — Vẽ Use Case Diagram Tuần: 4 | 14/04 – 20/04/2026


3.3.1 Use Case Diagram

Biểu Đồ Ca Sử Dụng (UML)

Biểu đồ ca sử dụng Fluxion MDM

Hình 3.3.1: Biểu đồ ca sử dụng UML với 4 tác nhân (Admin, Operator, Device, System) và 20 ca sử dụng. Đỏ = chỉ Admin (User Management). Operator có quyền tất cả device actions bao gồm release. Quan hệ «include» và «extend» thể hiện phụ thuộc giữa các ca sử dụng.

Mermaid Diagram (tham khảo)

graph LR
    subgraph Actors
        ADMIN((Admin))
        OPERATOR((Operator))
        DEVICE((Device))
        SYSTEM((System))
    end

    subgraph "Device Management"
        UC1[Enroll Device]
        UC2[Lock Device]
        UC3[Unlock Device]
        UC4[Send Message]
        UC5[Lock with Message]
        UC6[Release Device]
        UC7[Query Devices]
        UC8[View Device Detail]
    end

    subgraph "Command Pipeline"
        UC9[Track Command Status]
        UC10[View Command History]
        UC11[Send Bulk Commands]
    end

    subgraph "Dashboard"
        UC12[View Dashboard Overview]
        UC13[Receive Real-time Updates]
    end

    subgraph "NLP Chatbot"
        UC14[Chat Natural Language]
        UC15[Confirm Action]
    end

    subgraph "User Management"
        UC16[Login / Logout]
        UC17[Manage Users]
    end

    subgraph "Configuration"
        UC21[Manage Message Templates]
        UC22[Manage TACs]
        UC23[View Action Logs]
        UC24[Download Error Report]
    end

    subgraph "System Operations"
        UC18[Process Device Check-in]
        UC19[Retry Failed Commands]
        UC20[Process DLQ]
    end

    ADMIN --> UC1 & UC2 & UC3 & UC4 & UC5 & UC6 & UC7 & UC8
    ADMIN --> UC9 & UC10 & UC11
    ADMIN --> UC12 & UC13
    ADMIN --> UC14 & UC15
    ADMIN --> UC16 & UC17
    ADMIN --> UC21 & UC22 & UC23 & UC24

    OPERATOR --> UC2 & UC3 & UC4 & UC5 & UC7 & UC8
    OPERATOR --> UC9 & UC10
    OPERATOR --> UC12 & UC13
    OPERATOR --> UC14 & UC15
    OPERATOR --> UC16
    OPERATOR --> UC23 & UC24

    DEVICE --> UC18

    SYSTEM --> UC19 & UC20
Loading

3.3.2 Danh Sách Use Cases

Device Management

UC Tên Actor(s) Mô tả
UC1 Enroll Device Admin Đăng ký thiết bị iOS qua ADE/DEP; FSM: idle → registered → enrolled → active
UC2 Lock Device Admin, Operator Gửi lệnh khóa; FSM: active → locked
UC3 Unlock Device Admin, Operator Gửi lệnh mở khóa; FSM: locked → active
UC4 Send Message Admin, Operator Gửi push message tới device; internal transition (state không đổi, chỉ khi active)
UC5 Lock Message Admin, Operator Gửi message hiển thị trên lock screen; internal transition (state không đổi, chỉ khi device locked)
UC6 Release Device Admin, Operator Kết thúc quản lý khi khách hoàn tất hợp đồng trả góp (graduation) — unenroll MDM profile, máy trở thành 100% sở hữu khách, data giữ nguyên. FSM: active/lockedreleased (terminal)
UC7 Query Devices Admin, Operator Truy vấn danh sách thiết bị theo state, search, filter
UC8 View Device Detail Admin, Operator Xem thông tin chi tiết: serial, OS, state, history

Command Pipeline

UC Tên Actor(s) Mô tả
UC9 Track Command Status Admin, Operator Xem real-time trạng thái: ACTION_PENDING → ACTION_SENT → ACTION_COMPLETED/FAILED
UC10 View Command History Admin, Operator Xem lịch sử lệnh theo thiết bị hoặc thời gian
UC11 Send Bulk Commands Admin Gửi lệnh đồng thời cho nhiều devices (fan-out SNS)

Dashboard

UC Tên Actor(s) Mô tả
UC12 View Dashboard Overview Admin, Operator Tổng quan: device count theo state, biểu đồ thống kê
UC13 Receive Real-time Updates Admin, Operator Nhận cập nhật tức thì qua AppSync Subscriptions

NLP Chatbot

UC Tên Actor(s) Mô tả
UC14 Chat Natural Language Admin, Operator Gửi lệnh bằng tiếng Việt/Anh; LLM nhận dạng intent + gọi tool
UC15 Confirm Action Admin, Operator Xác nhận action trước khi thực thi (tất cả commands đều cần confirm)

User Management

UC Tên Actor(s) Mô tả
UC16 Login / Logout Admin, Operator Xác thực qua Cognito; nhận JWT token
UC17 Manage Users Admin Tạo, sửa, vô hiệu hoá tài khoản user; gán role

System Operations

UC Tên Actor(s) Mô tả
UC18 Process Device Check-in Device Device gửi callback sau khi thực thi lệnh; checkin-handler Lambda cập nhật FSM + action status
UC19 Retry Failed Commands System SQS tự động retry message thất bại (maxReceiveCount=3)
UC20 Process DLQ System Xử lý messages trong Dead Letter Queue; alert ops

Configuration

UC Tên Actor(s) Mô tả
UC21 Manage Message Templates Admin CRUD MessageTemplate (name, content, notificationType FULLSCREEN/POPUP, 3 icons); dùng trong assignAction.messageTemplateId
UC22 Manage TACs Admin CRUD TAC (tac 8-digit, provisioningType, brand, model, marketingName) phục vụ device identification
UC23 View Action Logs Admin, Operator Xem batch action execution summary (batchId, status, totalDevices, errorCount)
UC24 Download Error Report Admin, Operator Gọi generateActionLogErrorReport(batchId) → nhận pre-signed S3 URL → download CSV (deviceId, errorCode, message)

3.3.3 Use Case Descriptions (Brief Format)

UC2: Lock Device

Field Detail
Actor Admin, Operator
Precondition Device state = active; user authenticated với role Admin hoặc Operator
Main Flow 1. User chọn device trên dashboard (hoặc qua chatbot)
2. User chọn action "Lock"
3. System yêu cầu xác nhận
4. User xác nhận
5. System dispatch lệnh qua command pipeline
6. Dashboard cập nhật real-time: ACTION_PENDING → ACTION_SENT → ACTION_COMPLETED
7. Device state chuyển sang locked
Alternative 4a. User huỷ → không thực thi
6a. APNS delivery thất bại → retry 3 lần → DLQ
Postcondition Device state = locked; action_execution = ACTION_COMPLETED

UC14: Chat Natural Language

Field Detail
Actor Admin, Operator
Precondition User authenticated; chat session active
Main Flow 1. User nhập lệnh: "khóa thiết bị iPhone-001"
2. LLM nhận dạng intent = lock, entity = iPhone-001
3. LLM gọi tool send_device_command(device_id, "lock", confirmed=false)
4. System trả về confirmation prompt
5. LLM hiển thị: "Xác nhận khóa thiết bị iPhone-001?"
6. User: "xác nhận"
7. LLM gọi send_device_command(confirmed=true)
8. System thực thi command pipeline
9. LLM trả kết quả: "Đã gửi lệnh khóa thiết bị iPhone-001"
Alternative 2a. Intent không rõ → LLM hỏi làm rõ
3a. Device không tìm thấy → LLM gọi query_devices để gợi ý
6a. User: "huỷ" → không thực thi
Postcondition Chat messages lưu vào RDS; command dispatched nếu confirmed

3.3.4 Actor — Use Case Access Matrix

Use Case Admin Operator Device System
UC1 Enroll
UC2 Lock
UC3 Unlock
UC4 Send Message
UC5 Lock w/ Message
UC6 Release
UC7 Query
UC8 Detail
UC9 Track Status
UC10 History
UC11 Bulk
UC12 Dashboard
UC13 Real-time
UC14 Chat
UC15 Confirm
UC16 Login
UC17 Manage Users
UC18 Check-in
UC19 Retry
UC20 DLQ
UC21 Manage Templates
UC22 Manage TACs
UC23 View Action Logs
UC24 Download Error Report

Kết Luận

Sơ đồ Use Case Diagram của Fluxion MDM bao phủ toàn diện 20 use cases phân bố trên 6 nhóm chức năng: Device Management (UC1–UC8), Command Pipeline (UC9–UC11), Dashboard (UC12–UC13), NLP Chatbot (UC14–UC15), User Management (UC16–UC17), và System Operations (UC18–UC20). Bốn tác nhân (Admin, Operator, Device, System) có ranh giới trách nhiệm rõ ràng — Admin có toàn quyền, Operator có quyền thực hiện tất cả device actions (bao gồm release) nhưng bị hạn chế ở bulk commands và user management, Device chỉ tham gia UC18 (check-in callback), và System xử lý tự động retry/DLQ.

Ma trận Actor — Use Case Access (mục 3.13) ánh xạ trực tiếp từ yêu cầu phân quyền trong FR5 (RBAC), đảm bảo nguyên tắc least privilege: Operator không thể quản lý user, chỉ Admin mới thực hiện được quản trị tài khoản. Use case UC14–UC15 (chatbot + confirmation) thể hiện cơ chế safety gate 2 bước — mọi command action đều yêu cầu xác nhận tường minh, ngăn ngừa thực thi nhầm lệnh qua giao diện ngôn ngữ tự nhiên.

Toàn bộ 20 use cases có thể truy vết ngược về các yêu cầu chức năng FR1–FR5 trong mục 3.2, đảm bảo độ phủ hoàn chỉnh (complete coverage) giữa phân tích yêu cầu và thiết kế use case. Hai use case mở rộng chi tiết (UC2 Lock Device, UC14 Chat Natural Language) minh họa các luồng chính và luồng ngoại lệ tiêu biểu của hệ thống.

Tài Liệu Tham Khảo

[1] Jacobson, I. Object-Oriented Software Engineering: A Use Case Driven Approach. Addison-Wesley, 1992.

[2] Cockburn, A. Writing Effective Use Cases. Addison-Wesley, 2001.

[3] OMG. Unified Modeling Language Specification, v2.5.1. 2017. https://www.omg.org/spec/UML/

⚠️ **GitHub.com Fallback** ⚠️