> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/~/revisions/VPtD4w6TGRsqMHNQKDN0/org/bulk-role-permission.md).

# 批次成員與權限管理

### 功能簡介

MaiAgent 提供強大的批次管理功能，適合需要大量新增或管理成員的情境。透過 Excel 檔案匯入，可一次完成多位成員的新增與角色分配，大幅提升管理效率。

***

### 批次功能入口

在成員管理頁面，點擊右上角的「<mark style="color:blue;">批次功能</mark>」按鈕：

\[\[IMG→批次功能下拉選單截圖]]

***

### 批次新增成員至組織

此功能可透過 Excel 檔案一次新增多位成員到組織。

\[\[IMG→批次新增成員視窗截圖]]

**操作步驟：**

1. **下載範本**：點擊「下載範本」取得 Excel 範本檔案
2. **編輯範本**：在範本中填入成員的 Email（必填欄位）
3. **上傳檔案**：將編輯好的檔案拖放或點擊上傳
4. **執行匯入**：點擊「上傳並執行」完成批次新增

#### Excel 檔案格式

| 欄位名稱                | 必填   | 說明                       |
| ------------------- | ---- | ------------------------ |
| **Name**            | 選填   | 成員顯示名稱，若未填則自動使用 Email 前綴 |
| **Email(required)** | ✅ 必填 | 成員的電子郵件地址                |

#### 範例檔案內容

| Name | Email(required)           |
| ---- | ------------------------- |
| 王小明  | <ming.wang@company.com>   |
| 李小華  | <hua.li@company.com>      |
| 張大偉  | <david.zhang@company.com> |
|      | <john@company.com>        |

{% hint style="info" %}
**案例說明**

某企業需要將 50 位新進員工加入 MaiAgent 組織：

1. IT 管理員從人資系統匯出員工名單（含姓名、Email）
2. 將資料整理成上述格式的 Excel 檔案
3. 上傳執行後，系統會：
   * 為已有 MaiAgent 帳號的員工：直接加入組織
   * 為尚無帳號的員工：自動建立帳號並加入組織
4. 所有新成員自動獲得「預設角色」權限
   {% endhint %}

{% hint style="warning" %}
**檔案格式說明**

* 僅支援 .xlsx 格式
* 檔案大小限制 10 MB
* Email 為必填欄位
* 已存在組織的成員將被忽略（不會重複加入）
  {% endhint %}

***

### 批次新增角色成員

此功能可批次為多位成員指派角色，實現自動分配權限。

**操作步驟：**

1. **下載範本**：點擊「下載上傳範本」取得 Excel 範本
2. **下載參考資料**（選用）：點擊「下載目前成員角色分配」查看現有配置
3. **編輯範本**：
   * 填入成員 Email
   * 填入要分配的角色 ID
4. **上傳檔案**：將編輯好的檔案拖放或點擊上傳
5. **執行匯入**：點擊「上傳並執行」完成批次角色分配

#### Excel 檔案格式

| 欄位名稱                    | 必填   | 說明                          |
| ----------------------- | ---- | --------------------------- |
| **Name**                | 選填   | 成員顯示名稱，若未填則自動使用 Email 前綴    |
| **Email(required)**     | ✅ 必填 | 成員的電子郵件地址                   |
| **Group\_id(required)** | ✅ 必填 | 要分配的角色 ID（UUID 格式）          |
| **Group\_name**         | 選填   | 角色名稱（僅供參考，系統以 Group\_id 為準） |

{% hint style="info" %}
**如何取得角色 ID？**

點擊「下載目前成員角色分配」可匯出包含所有角色 ID 的參考檔案，或至\[\[LINK→角色權限管理]]頁面查看各角色的 ID。
{% endhint %}

#### 範例檔案內容

| Name | Email(required)            | Group\_id(required)                  | Group\_name |
| ---- | -------------------------- | ------------------------------------ | ----------- |
| 王小明  | <ming.wang@company.com>    | 4e368ab4-c543-48a2-bbb8-f6f5a0bf6c61 | 產品部門        |
| 王小明  | <ming.wang@company.com>    | 7a2b3c4d-e5f6-7890-abcd-ef1234567890 | AI 助理管理員    |
| 李小華  | <hua.li@company.com>       | 4e368ab4-c543-48a2-bbb8-f6f5a0bf6c61 | 產品部門        |
| 張大偉  | <david.zhang@company.com>  | 8b9c0d1e-f2a3-4567-89ab-cdef01234567 | 研發部門        |
| 新員工  | <new.employee@company.com> | 4e368ab4-c543-48a2-bbb8-f6f5a0bf6c61 | 產品部門        |

{% hint style="success" %}
**案例說明：部門權限批次設定**

某企業完成 Azure AD 串接後，需要為 100 位員工依部門分配不同的資源存取權限（關於 Azure AD 設定，請參閱\[\[LINK→第三方登入（SSO）]]）：

**步驟 1：準備角色**

* 在 MaiAgent 建立部門角色：「產品部門」「研發部門」「業務部門」
* 為各角色設定對應的功能權限（詳見\[\[LINK→角色權限管理]]）
* 為各角色分配可存取的 AI 助理、知識庫、對話平台

**步驟 2：準備 Excel**

* 從人資系統匯出員工名單（含部門資訊）
* 對照部門名稱填入對應的角色 ID
* 同一位員工可出現多列（例如王小明同時屬於產品部門和 AI 助理管理員）

**步驟 3：執行匯入**

* 上傳 Excel 後，系統會：
  * 已在組織的成員：直接分配角色
  * 尚未加入組織的 Email：自動邀請加入並分配角色
  * 成員立即獲得角色對應的權限

**成果**

* 100 位員工在 5 分鐘內完成權限設定
* 各部門員工僅能存取與其業務相關的 AI 助理、知識庫、對話平台
  {% endhint %}

{% hint style="warning" %}
**檔案格式說明**

* 僅支援 .xlsx 格式
* 檔案大小限制 10 MB
* Email 和角色 ID 為必填欄位
* 同一 Email 可出現在多列（一人可擁有多個角色）
* 不存在組織的 Email 將自動建立帳號並邀請至組織
* **預設角色（DEFAULT）不可透過 Excel 批次分配**
* **擁有者角色（OWNER）不可透過 Excel 批次分配**
  {% endhint %}

***

### 批次管理流程圖

```mermaid
sequenceDiagram
    participant Admin as 管理員
    participant MaiAgent as MaiAgent 平台
    participant System as 系統處理
    
    Admin->>MaiAgent: 1. 下載 Excel 範本
    Admin->>Admin: 2. 編輯範本（填入 Email、角色 ID）
    Admin->>MaiAgent: 3. 上傳 Excel 檔案
    MaiAgent->>System: 4. 解析檔案內容
    System->>System: 5. 驗證資料格式
    
    alt 成員已存在於組織
        System->>System: 6a. 更新角色分配
    else 成員不存在於組織
        System->>System: 6b. 自動邀請加入組織
        System->>System: 6c. 分配自訂角色
    end
    
    System->>MaiAgent: 7. 回傳處理結果
    MaiAgent->>Admin: 8. 顯示成功/失敗訊息
```

***

### 延伸閱讀

* 角色與權限的詳細設定，請參閱\[\[LINK→角色權限管理]]
* EIP 登入的自動角色同步機制，請參閱\[\[LINK→第三方登入（SSO）]]


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/~/revisions/VPtD4w6TGRsqMHNQKDN0/org/bulk-role-permission.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
