全部產品
Search
文件中心

Drive and Photo Service:角色授權

更新時間:Dec 22, 2025

本篇主要介紹角色授權相關介面。

說明

請求參數中的 options: IPDSRequestConfig 基於 axios 的 request config 封裝,詳情請看:AxiosRequestConfig

assignRole 方法

重要

需要Admin許可權。

分配角色,當前支援將使用者佈建為團隊管理員角色。

const result = await client.assignRole(params, options)

舉例

const user_id = 'xxx';
const group_id = 'xxxx';

await client.assignRole({
  identity: {
    identity_type: 'IT_User',
    identity_id: user_id,
  },
  role_id: 'SystemGroupAdmin',
  manage_resource_type: 'RT_Group',
  manage_resource_id: group_id,
});

參數

欄位

類型

必選

說明

params

IAssignRoleReq

授權角色請求參數

options

IPDSRequestConfig

請求參數

IAssignRoleReq

欄位

類型

必選

說明

identity

IIDentity

被授權者的唯一標識,一般為使用者ID或者分組ID

role_id

string

角色ID,目前僅支援: "SystemGroupAdmin"

manage_resource_type

string

管理資源的類型。目前僅支援: "RT_Group"

manage_resource_id

string

管理的資源ID,比如分組的ID。

IIDentity

欄位

類型

必選

說明

identity_type

string

管理資源的類型。目前僅支援:"IT_User" | "IT_Group"

identity_id

string

唯一標識 user_id 或者 group_id。

返回

cancelAssignRole 方法

重要

需要Admin許可權。

取消分配角色,當前僅支援取消團隊管理員角色。

const result = await client.cancelAssignRole(params, options)

舉例

const user_id = 'xxx';
const group_id = 'xxxx';

await client.cancelAssignRole({
  identity: {
    identity_type: 'IT_User',
    identity_id: user_id,
  },
  role_id: 'SystemGroupAdmin',
  manage_resource_type: 'RT_Group',
  manage_resource_id: group_id,
});

參數

欄位

類型

必選

說明

params

ICancelAssignRoleReq

授權角色請求參數

options

IPDSRequestConfig

請求參數

ICancelAssignRoleReq

欄位

類型

必選

說明

identity

IIDentity

被授權者的唯一標識,一般為使用者ID或者分組ID

role_id

string

角色ID,目前僅支援: "SystemGroupAdmin"

manage_resource_type

string

管理資源的類型。目前僅支援: "RT_Group"

manage_resource_id

string

管理的資源ID,比如分組的ID。

返回

listAssignments 方法

重要

需要Admin許可權或者分組管理員權限。

列舉已指派的角色列表,比如可通過團隊ID擷取分組管理員角色列表。

const result = await client.listAssignments(params, options)

舉例

const group_id = 'xxxx';

await client.listAssignments({
  manage_resource_type: 'RT_Group',
  manage_resource_id: group_id,
  limit: 100,
});

參數

欄位

類型

必選

說明

params

IListAssignmentsReq

授權角色請求參數

options

IPDSRequestConfig

請求參數

IListAssignmentsReq

欄位

類型

必選

說明

limit

long

限定此次返回資源的數量,取值範圍[1,100]。

返回結果可以小於指定的數量,但不能多於指定的數量。

marker

string

分頁開始標識。

manage_resource_type

string

管理的資源類型,當前僅支援: RT_Group,查詢某分組的管理員授權列表

manage_resource_id

string

管理的資源ID,比如分組的ID

返回

欄位

類型

說明

assignment_list

IAssignment[] | null

返回授權資訊列表

next_marker

string

下一頁起始資源標識符, 最後一頁該值為空白

IAssignment

欄位

類型

說明

domain_id

string

domain ID

identity

IIDentity

被授權者的唯一標識,一般為使用者ID或者分組ID

role_id

string

被授權的角色ID

manage_resource_type

string

管理的資源類型,比如: RT_Group,表示分組類型

manage_resource_id

string

管理的資源ID,比如分組的ID

creator

string

建立者ID

created_at

number

建立時間,從1970年1月1日0點到當前的毫秒時間戳記