全部產品
Search
文件中心

Drive and Photo Service:群組管理

更新時間:Apr 02, 2025

本文檔描述PDS的群組管理功能,您可以通過PDS提供的預設用戶端使用群組管理功能,也可以參考該文檔調用API實現群組管理功能。

基本概念

  • 群組可以理解成企業的一個部門,群組下面可以添加使用者,也可以添加其他群組。

  • 群組成員有兩種類型,一種是使用者,一種是群組。

例如:

image

說明
  • 使用者可以加入多個群組,建議一個使用者加入的群組不超過10個,否則會降低查詢效能。

  • 群組只能在建立時選擇對應的父群組,暫時不支援移動。 如果建立群組時不選擇父群組則該群組作為根群組。

  • 群組層級最多不能超過10層。

API調用及樣本

1. 建立群組

如果需要建立一個根群組,需將is_root參數設定為true。 如果建立的不是根群組,則需要設定parent_group_id,並把is_root設定為false

請求樣本

// 建立根群組
{
  "group_name": "某公司", 
  "is_root": true
}

// 在某公司下建立研發部
{
  "group_name": "研發部", 
  "is_root": false,
  "parent_group_id": "testParentGroupId"
}

響應樣本

{
  "domain_id": "testDomainId",
  "group_id": "testGroupId",
  "group_name": "testGroupName",
  "description": "",
  "created_at": 1677335855709,
  "updated_at": 1677335855709,
  "creator": "",
  "permission": null
}

2. 列舉群組成員

如需列舉所有根群組,則不傳group_id參數。

請求樣本

{
  "group_id": "testGroupId", 
  "limit": 100
}

響應樣本

{
  "group_items": [
    {
      "domain_id": "testDomainId",
      "group_id": "testGroupId",
      "group_name": "研發部",
      "description": "",
      "created_at": 1677336367210,
      "updated_at": 1677336367210,
      "creator": "",
      "permission": null
    }
  ],
  "user_items": [],
  "next_marker": ""

3. 新增成員到群組

此介面只允許添加使用者,群組可以在建立時通過parent_group_id來設定父群組

請求樣本

{
  "group_id": "testGroupId",
  "member_id": "testMemberId",
  "member_type": "user"
}

響應樣本

204 NoContent

4. 從群組移除成員

此介面只允許移除使用者,群組只能先將成員移除後再刪除。

請求樣本

{
  "group_id": "testGroupId",
  "member_id": "testMemberId",
  "member_type": "user"
}

響應樣本

204 NoContent

5. 刪除群組

此介面僅允許刪除沒有成員的群組。

請求樣本

{
  "group_id": "testGroupId"
}

響應樣本

204 NoContent