Files
TEMP_spec_system_V3/代辦.txt
beabigegg b9557250a4 1st
2025-08-27 18:03:54 +08:00

45 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### **交付與後續步驟**
程式碼已準備就緒,但要使其正常運作,您需要完成以下**關鍵步驟**
**1. 填寫環境變數 (`.env` 檔案):**
請根據您從 IT 部門獲取的資訊,在專案根目錄的 `.env` 檔案中新增或修改以下變數。這一步至關重要。
```ini
# --- LDAP Settings ---
LDAP_SERVER=dc1.panjit.com.tw
LDAP_PORT=389
LDAP_USE_SSL=false
# 服務帳號 (用於查詢群組)
LDAP_BIND_USER_DN="CN=ServiceAccount,OU=Services,DC=panjit,DC=com,DC=tw"
LDAP_BIND_USER_PASSWORD="service_account_password"
# 使用者和群組的搜尋基礎
LDAP_SEARCH_BASE="OU=Users,DC=panjit,DC=com,DC=tw"
LDAP_USER_LOGIN_ATTR=userPrincipalName
# --- SMTP Settings ---
SMTP_SERVER=mail.panjit.com.tw
SMTP_PORT=25
SMTP_USE_TLS=false
# 發信人帳號
SMTP_SENDER_EMAIL=app-noreply@panjit.com.tw
SMTP_SENDER_PASSWORD="email_password_if_needed"
```
**2. 安裝新的 Python 套件:**
在您的開發環境中執行以下指令,以安裝 `ldap3`
```bash
pip install -r requirements.txt
```
**3. 自訂郵件通知:**
* 我添加的郵件通知僅作為一個**範例**。您需要:
* 將範例中的 `'TempSpec_Approvers'` 替換為貴公司**實際的郵件群組名稱**。
* 將此通知邏輯複製並修改,應用到其他需要發送通知的地方,例如 `terminate_spec` (結束通知) 和 `extend_spec` (展延通知)。
* 根據需要建立一個排程任務 (例如,使用 APScheduler 或 Windows 工作排程器),定期檢查即將到期的暫規並發送提醒郵件。
**4. 測試:**
完成上述配置後,請啟動應用程式並使用您的 AD 帳號進行登入測試。同時,觸發一個暫規生效的流程,檢查郵件是否能成功發送。
本次的架構轉移工作已完成。如果您在配置或測試過程中遇到任何問題,或需要對通知邏輯進行進一步的調整,請隨時提出。