Admin SDK로 멤버와 초대 관리하기
Admin SDK로 멤버와 초대 관리하기
멤버를 초대하고, 멤버십을 관리하고, 역할을 할당할 수 있어요.
출처: 문서
본문
개요 (Overview)
멤버는 계정에 접근 권한이 있는 사람들이며, 두 수준으로 존재해요:
- 조직 멤버(Organization members) 는 조직 전체에 속해요. 초대받은 사용자는 조직 멤버가 되고, 조직 수준 역할을 받을 수 있어요.
- 프로젝트 멤버(Project members) 는 단일 프로젝트에 속해요. 조직 멤버를 프로젝트에 추가해 프로젝트 수준 역할로 프로젝트 접근을 부여해요.
사용자는 조직 멤버가 되어야 프로젝트에 추가될 수 있어요. 새 멤버는 초대를 수락해 가입하고, 프로젝트 멤버십은 특정 프로젝트에 대한 접근을 부여해요.
%%{init: {'flowchart': {'nodeSpacing': 55, 'rankSpacing': 90}}}%%
flowchart LR
Invite["Invitation<br/>email + optional role"] --> Member["Organization Member<br/>organization-level role"]
Member --> ProjectA["Project A Member<br/>project-level role"]
Member --> ProjectB["Project B Member<br/>project-level role"]
이 페이지의 모든 메서드는 조직 API 키가 필요해요. 클라이언트 생성은 퀵스타트를 참고해요.
멤버 (Members)
조직과 개별 프로젝트의 인원을 관리할 수 있어요.
멤버 목록 조회 (List Members)
멤버를 페이지 단위로 나열할 수 있어요. 기본값은 page=1, page_size=25예요.
Python
from confidentai import ConfidentAI
client = ConfidentAI()
org = client.organization()
project = client.project("clq9z3x1k0001la08f7t3g5p2")
# Organization members
members = org.members.list(page=1, page_size=25)
# Project members
project_members = project.members.list(page=1)
TypeScript
import { ConfidentAI } from "confidentai";
const client = new ConfidentAI();
const org = client.organization();
const project = client.project("clq9z3x1k0001la08f7t3g5p2");
// Organization members
const members = await org.members.list({ page: 1, pageSize: 25 });
// Project members
const projectMembers = await project.members.list({ page: 1 });
멤버 역할 업데이트 (Update a Member's Role)
멤버의 user_id로 역할을 할당할 수 있어요. 역할은 역할, 정책, 권한 섹션에서 관리해요.
Python
org = client.organization()
project = client.project("clq9z3x1k0001la08f7t3g5p2")
# Organization-level role
member = org.members.update_role("clq8n3p9k0002la09a1b7c4d2", role_id="b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e")
# Project-level role
project_member = project.members.update_role("clq8n3p9k0002la09a1b7c4d2", role_id="b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e")
TypeScript
const org = client.organization();
const project = client.project("clq9z3x1k0001la08f7t3g5p2");
// Organization-level role
const member = await org.members.updateRole("clq8n3p9k0002la09a1b7c4d2", {
roleId: "b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e",
});
// Project-level role
const projectMember = await project.members.updateRole("clq8n3p9k0002la09a1b7c4d2", {
roleId: "b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e",
});
멤버 제거 (Remove a Member)
멤버의 user_id로 조직 또는 특정 프로젝트에서 제거할 수 있어요.
Python
org = client.organization()
project = client.project("clq9z3x1k0001la08f7t3g5p2")
org.members.remove("clq8n3p9k0002la09a1b7c4d2")
project.members.remove("clq8n3p9k0002la09a1b7c4d2")
TypeScript
const org = client.organization();
const project = client.project("clq9z3x1k0001la08f7t3g5p2");
await org.members.remove("clq8n3p9k0002la09a1b7c4d2");
await project.members.remove("clq8n3p9k0002la09a1b7c4d2");
초대 (Invitations)
조직이나 프로젝트에 새 사람을 초대하고, 아직 보류 중인 초대를 관리할 수 있어요.
초대 목록 조회 (List Invitations)
조직 또는 프로젝트 수준의 보류 중인 초대를 나열할 수 있어요.
Python
org = client.organization()
project = client.project("clq9z3x1k0001la08f7t3g5p2")
invitations = org.invitations.list()
project_invitations = project.invitations.list()
TypeScript
const org = client.organization();
const project = client.project("clq9z3x1k0001la08f7t3g5p2");
const invitations = await org.invitations.list();
const projectInvitations = await project.invitations.list();
초대 생성 (Create Invitations)
이메일을 한 번에 하나 이상 초대할 수 있고, 선택적인 role_id는 초대받은 사람이 가입할 때 역할을 할당해요.
Python
org = client.organization()
project = client.project("clq9z3x1k0001la08f7t3g5p2")
# Organization invitations
invitations = org.invitations.create(
["[email protected]", "[email protected]"],
role_id="b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e",
)
# Project invitations
project_invitations = project.invitations.create(
["[email protected]"],
role_id="b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e",
)
TypeScript
const org = client.organization();
const project = client.project("clq9z3x1k0001la08f7t3g5p2");
// Organization invitations
const invitations = await org.invitations.create({
emails: ["[email protected]", "[email protected]"],
roleId: "b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e",
});
// Project invitations
const projectInvitations = await project.invitations.create({
emails: ["[email protected]"],
roleId: "b3f1c2a9-7d4e-4c1b-9a2f-1e6d8c0a4b7e",
});
초대 재전송 및 폐지 (Resend & Revoke Invitations)
invitation_id로 보류 중인 초대를 다시 보내거나, 수락 전에 폐지해 접근을 취소할 수 있어요.
Python
org = client.organization()
project = client.project("clq9z3x1k0001la08f7t3g5p2")
# Resend
org.invitations.resend(42)
project.invitations.resend(42)
# Revoke
org.invitations.revoke(42)
project.invitations.revoke(42)
TypeScript
const org = client.organization();
const project = client.project("clq9z3x1k0001la08f7t3g5p2");
// Resend
await org.invitations.resend(42);
await project.invitations.resend(42);
// Revoke
await org.invitations.revoke(42);
await project.invitations.revoke(42);
다음 단계 (Next Steps)
멤버에게 접근을 할당하기 전에 역할을 정의해요:
역할, 정책, 권한 (Roles, Policies & Permissions)
멤버에게 할당할 역할을 만들어요.
프로젝트 (Projects)
멤버가 속한 프로젝트를 관리해요.