跳过内容

成员

组织成员是有权访问您的 Capgo 组织的用户。每个成员都有特定的角色,决定了他们在组织内的权限。有效管理成员对于维护团队的安全和协作至关重要。

成员角色

成员角色

常规角色

常规角色
  • read: 可以查看资源,但无法进行修改
  • : 可以上传新包并查看资源upload
  • write: 可以修改资源并上传包
  • admin: 可以管理组织设置和成员
  • super_admin: 对组织有完全控制权

Invite Roles

邀请角色
  • invite_read: 等待读取访问邀请
  • invite_upload: 等待上传访问邀请
  • invite_write: 等待写入访问邀请
  • invite_admin: 等待管理员访问邀请
  • invite_super_admin: 等待超级管理员访问邀请

Best Practices

最佳实践
  1. Role Assignment: 分配角色时遵循最小特权原则
  2. Regular Audits: 定期审查成员访问并删除未使用的账户
  3. 入职流程: 为新成员添加和分配角色时有一个清晰的流程
  4. 离职流程: 当成员离开组织时,立即移除他们的访问权限

API接口

API接口

https://api.capgo.app/organization/members/

Add a new member to an organization or update an existing member’s role. Note that you can only invite users who already have a Capgo account - the email must correspond to an existing Capgo user.

interface MemberCreate {
orgId: string
email: string
role: "read" | "upload" | "write" | "admin" | "super_admin"
}

示例请求

示例请求
终端窗口
curl -X POST \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"orgId": "org_123",
"email": "newmember@example.com",
"role": "write"
}' \
https://api.capgo.app/organization/members/

成功响应

成功响应
{
"status": "OK",
"data": {
"uid": "user_789",
"email": "newmember@example.com",
"role": "invite_write",
"image_url": null
}
}

注意:

  • 当添加新成员时,他们会收到邀请邮件。他们的角色将以“invite_”开头,直到他们接受邀请。
  • 用户必须在接受邀请之前已经有一个Capgo账户。如果他们没有账户,他们应该首先在 https://console.capgo.app/register/

https://api.capgo.app/organization/members/

获取组织中的所有成员。

interface MemberQuery {
orgId: string
}
interface Member {
uid: string;
email: string;
image_url: string;
role: "invite_read" | "invite_upload" | "invite_write" | "invite_admin" | "invite_super_admin" | "read" | "upload" | "write" | "admin" | "super_admin";
}
终端窗口
curl -H "authorization: your-api-key" \
"https://api.capgo.app/organization/members/?orgId=org_123"
{
"data": [
{
"uid": "user_123",
"email": "john@example.com",
"image_url": "https://example.com/avatar.png",
"role": "admin"
},
{
"uid": "user_456",
"email": "jane@example.com",
"image_url": "https://example.com/avatar2.png",
"role": "write"
},
{
"uid": "user_789",
"email": "bob@example.com",
"image_url": null,
"role": "invite_read"
}
]
}

https://api.capgo.app/organization/members/

从组织中删除成员。立即撤销他们的访问。

interface MemberDelete {
orgId: string
email: string
}
终端窗口
curl -X DELETE \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"orgId": "org_123",
"email": "user@example.com"
}' \
https://api.capgo.app/organization/members/

成功响应

成功响应部分
{
"status": "OK"
}

错误处理

错误处理部分

常见错误场景和响应:

// Member not found
{
"error": "Member not found",
"status": "KO"
}
// Invalid role
{
"error": "Invalid role specified",
"status": "KO"
}
// Permission denied
{
"error": "Insufficient permissions to manage members",
"status": "KO"
}
// Cannot remove last admin
{
"error": "Cannot remove the last admin from the organization",
"status": "KO"
}
// Invalid email
{
"error": "Invalid email format",
"status": "KO"
}
// Member already exists
{
"error": "Member already exists in organization",
"status": "KO"
}

常见用例

常见用例部分
  1. 团队扩张添加具有适当角色权限的新团队成员
  2. 访问控制: 根据责任变化管理成员权限
  3. 安全审计: 定期审查成员列表和角色
  4. 团队重构: 在组织结构变化时更新角色