📌 專案摘要與治理定位 📌 Executive Summary & Governance Positioning
本儲存庫為一項企業管治開源示範專案,展示如何運用 Microsoft 365 原生低代碼生態與「治理即代碼」(Governance-as-Code)理念,構建零額外授權的考勤與防虛報內控系統。
This repository is an Enterprise Demo demonstrating how to implement Governance-as-Code using native Microsoft 365 standard connectors to build a zero-license attendance and anti-fraud internal control engine.
EnterpriseDemo-NOTAS 將傳統易遺失、難以追溯的紙本「非營運時段上班記錄表 (Demo-Form)」全面數位化。系統整合 Microsoft Forms 身分鎖定、Entra ID (Get user profile V2) 目錄防呆攔截、三級動態電子簽核(部門主管 ➔ 人力資源部 ➔ 高階營運主管)、HKT (UTC+8) 標準時區校正以及 SharePoint JSON 視覺化審計帳本,全面對齊 ISO/IEC 27001、27701、9001 及 ISO 45001 國際管理體系。
EnterpriseDemo-NOTAS digitizes traditional paper-based "Non-Operating Time Attendance Records (Demo-Form)". It orchestrates Microsoft Forms identity binding, Entra ID (Get user profile V2) directory validation, 3-tier dynamic Approvals (Line Manager ➔ HR ➔ Executive/COD), HKT (UTC+8) timezone normalization, and a SharePoint JSON-formatted audit ledger aligned with ISO/IEC 27001, 27701, 9001, and ISO 45001.
本系統架構 100% 採用確定性條件式規則引擎(Deterministic Conditional Logic),不含任何機器學習或自動化人事評分演算法,明確排除於《歐盟人工智能法案》(EU AI Act)及 ISO/IEC 42001 強制範圍之外;同時所有資料留存於企業本地租戶環境,不涉及跨境數據傳輸。
Operating entirely on deterministic conditional logic without machine learning or algorithmic profiling, this architecture is explicitly scoped out of the EU AI Act and ISO/IEC 42001, while keeping all audit records within the corporate local tenant with zero cross-border data export.
🏛️ 流程生命週期與治理閉環 🏛️ End-to-End Workflow Lifecycle & Governance Closure
強制組織登入驗證,轉換 HKT 時間戳,生成唯一單號 OT-YYYYMMDD-ID 寫入 SharePoint。Enforces org login, normalizes HKT timestamp, and creates SharePoint item OT-YYYYMMDD-ID.
向 Entra ID 驗證主管電郵;無效則觸發 Scope 異常攔截,自動駁回並發信終止流程。Validates manager email via Entra ID; invalid entries trigger Scope auto-rejection and termination.
派發 Approvals 卡片核實加班必要性;駁回即時結案,批准則推進至 HR審核中。Dispatches Approvals card to verify duty necessity; approval advances status to HR Review.
核對勞工條例工時上限與職安健單獨作業風險;批准則推進至 COD審批中。Reviews labor ordinance compliance and lone-working safety; approval advances to COD Review.
最終核准回寫 已批准歸檔,發送正式結案公函予員工並 Cc 人資備查留存 7 年。Final sign-off updates status to Approved & Archived, dispatches official notice, and retains 7 years.
🧪 互動式三階段工作流模擬器(1:1 還原 Power Automate 狀態機) 🧪 Interactive 3-Stage Workflow Simulator (Power Automate State Machine Replica)
在此體驗完整系統運作邏輯:包含 Entra ID 目錄防呆異常攔截(Scope runAfter: Failed)、三級串聯電子簽核狀態推進,以及 SharePoint Column Formatting JSON 動態視覺看板。
Experience the end-to-end orchestration: test Entra ID directory validation & Scope exception catching, interactively execute 3-tier sequential Approvals, and inspect the SharePoint Column Formatting JSON ledger.
📋 業務治理與權限隔離矩陣 📋 Governance & Control Isolation Matrix
| 階段Stage | 責任角色Role | 承載技術Technology Stack | 處置動作與審計控制紀錄Action & Audit Control |
|---|---|---|---|
| 一、填報立案1. Submission | 申報員工Applicant | Microsoft Forms + SharePoint | 強制組織帳號登入,展示 PICS 聲明,生成唯一單號(OT-YYYYMMDD-ID),初始狀態寫入 主管審批中。Enforces org login with PICS notice, generates unique ID (OT-YYYYMMDD-ID), sets status to Manager Review. |
| 二、目錄防呆2. Directory Check | 自動引擎Auto Engine | Office 365 Users (Get user profile V2) |
向 Entra ID 核實主管電郵;若查詢失敗或逾時,經由 Scope 攔截自動標記 已駁回 並發信退回,防止工作流掛起。Verifies manager email in Entra ID; if failed/timed out, Scope catches exception, marks Rejected, and notifies applicant. |
| 三、收件確認3. Acknowledgment | 自動引擎Auto Engine | Office 365 Outlook | 目錄驗證通過後即時發送收件回條,列明申報單號、HKT 提交時間與當前審批主管姓名,確保資訊透明。Dispatches confirmation receipt listing Case ID, HKT submission timestamp, and verified manager name. |
| 四、第 1 棒主管審批4. Tier 1 Manager | 部門主管Line Manager | M365 Approvals (Teams / Outlook) | 派發互動式簽核卡片;駁回即寫入 已駁回 結案,批准則記錄主管意見與 HKT 時間戳,推進至 HR審核中。Sends actionable approval card; rejection closes case, approval logs comment & HKT timestamp and advances to HR Review. |
| 五、第 2 棒 HR 審核5. Tier 2 HR | 人力資源部HR Compliance | M365 Approvals (Teams / Outlook) | 進行勞工法規工時與補償合理性覆核;批准則獨立回寫 HRAction 與簽核時間,推進至 COD審批中。Performs labor ordinance & compensation review; approval logs independent HRAction & timestamp, advancing to COD Review. |
| 六、第 3 棒 COD 批核6. Tier 3 Executive | 高階營運主管COD / Executive | M365 Approvals (Teams / Outlook) | 營運最高層最終核准,系統回寫 CODAction 並將總狀態鎖定為 已批准歸檔,完成不可篡改電子存證。Executive final sign-off writes CODAction and locks status as Approved & Archived with immutable audit trail. |
| 七、閉環通報7. Audit Closure | 系統閉環System Closure | Office 365 Outlook + SharePoint | 發送全線核准正式結案公函予申請人,並自動 Cc 人力資源歸檔信箱備查,依留存標籤保存至少 7 年。Sends official approval notice to applicant with auto-Cc to HR archive mailbox; retained for 7 years under retention policy. |
⚖️ 法律法規與 ISO 國際標準對齊 ⚖️ Regulatory Alignment & ISO Standards Mapping
ISO/IEC 27001 & 27701 (資安與私隱InfoSec & Privacy)
SharePoint 核心清單剔除全組織廣泛讀取權限,執行最小權限原則(RBAC);每一級簽核均記錄 UPN 身分與不可篡改時間戳記。Core lists strip broad org read access to enforce RBAC least privilege; every approval tier logs UPN identity and immutable timestamps.
ISO 9001:2015 (品質管理體系Quality Management)
落實條款 7.5 成文資訊管理,將易遺失、字跡不清之傳統紙本表單轉化為具備完整版本歷程與結構化 Schema 之數位資產。Fulfills Clause 7.5 Documented Information by converting paper forms into version-controlled, schema-validated digital assets.
ISO 45001:2018 (職安健管理體系OH&S Management)
落實條款 6.1 & 8.1 運行策劃與危害辨識,事前掌握深夜、假日或惡劣天氣下之單獨作業(Lone Working)與超時工作健康風險。Supports Clauses 6.1 & 8.1 Hazard Identification by providing visibility over night-shift, holiday, and lone-working fatigue risks.
明確豁免範疇Explicit Exemptions (Non-AI & Local)
100% 確定性規則引擎,無機器學習模型,宣告排除 EU AI Act / ISO 42001;全數留存於本地租戶雲端,宣告排除跨境傳輸法規。100% deterministic rule engine with zero ML models, scoping out EU AI Act / ISO 42001; confined to local tenant, zero cross-border export.
⚙️ 技術工程亮點與開源治理資產 ⚙️ Technical Engineering Highlights & Governance Artifacts
1. 零額外授權架構Zero-License Architecture
全流程僅調用 M365 商業標準版內建標準連接器(Forms、SharePoint、Users、Outlook、Approvals),零 Premium 授權支出。Uses solely M365 Standard Connectors (Forms, SharePoint, Users, Outlook, Approvals) with zero Premium licensing fees.
2. 目錄級異常攔截Scope Exception Handling
配置 Configure run after 監聽 Get user profile (V2) 失敗與逾時狀態,3 秒內自動攔截無效電郵,杜絕流程掛起 30 天。Uses Configure run after on Get user profile (V2) failures/timeouts to auto-reject invalid emails in 3 seconds, preventing 30-day hangs.
3. 獨立三級欄位冪等性Tiered Field Isolation
資料庫拆解 ManagerAction、HRAction 與 CODAction 獨立欄位與簽核時間戳,確保多級意見互不覆寫。Separates ManagerAction, HRAction, and CODAction columns and timestamps so multi-tier audit trails never overwrite.
4. 雲端時區標準化HKT Timezone Normalization
透過 convertTimeZone 函數統一將雲端 UTC 轉為 UTC+8 香港標準時間,消除深夜出勤紀錄之 8 小時時差爭議。Normalizes cloud UTC to UTC+8 Hong Kong Time via convertTimeZone expressions, eliminating 8-hour shift audit discrepancies.