用途:管理决定谁可以编辑智能体、与其对话或查看分析数据的角色访问控制。可通过 API 查询角色策略、搜索用户和群组,并授予或撤销 editor、chat、analytics_viewer 角色。
认证与约定:Base URL 为 https://api.iblai.app,每次请求需带请求头 Authorization: Api-Token $IBLAI_API_KEY。路径变量中 {org} = $IBLAI_ORG,{username} = $IBLAI_USERNAME,{mentor} 为智能体的唯一 id。尚未连接时先运行 /iblai-api-login 以填充 IBLAI_ORG、IBLAI_USERNAME、IBLAI_API_KEY。
读取操作:通过 GET …/users/{username}/mentors/{mentor}/settings/ 解析数字 mentor_id;通过 GET …/rbac/mentor-access/?mentor_id={id}&platform_key={org} 列出当前角色策略;通过 POST …/rbac/permissions/check/ 检查用户能否搜索用户/群组(请求体含 platform_key 与 resources: ["/users/", "/groups/"]);通过 GET …/platform/users/ 和 GET …/rbac/groups/ 进行用户与群组自动补全。
写入操作:所有访问变更都走 POST https://api.iblai.app/dm/api/core/rbac/mentor-access/,请求体含 platform_key、mentor_id、role(editor | chat | analytics_viewer)以及 users_to_add、users_to_remove、groups_to_add、groups_to_remove、emails_to_add、usernames_to_add 等数组。
限制与注意:写入端点使用数字 mentor_id,而非 {mentor} UUID,需先通过 settings/ 读取解析;每次 POST 只能设置一个角色,增删数组仅对该角色生效;搜索前先用 permissions/check/,若无 /users/ 或 /groups/ 权限则跳过对应自动补全;emails_to_add 和 usernames_to_add 可直接按标识符邀请而无需先查 id。