MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getOrgAdminEmails

Function getOrgAdminEmails

server/src/utils/org-admins.ts:11–35  ·  view source on GitHub ↗
(
  workos: WorkOS,
  orgId: string
)

Source from the content-addressed store, hash-verified

9 * Get email addresses of org admins and owners from WorkOS.
10 */
11export async function getOrgAdminEmails(
12 workos: WorkOS,
13 orgId: string
14): Promise<string[]> {
15 const orgMemberships = await workos.userManagement.listOrganizationMemberships({
16 organizationId: orgId,
17 });
18
19 const admins = orgMemberships.data.filter(
20 m => m.role?.slug === 'admin' || m.role?.slug === 'owner'
21 );
22
23 const emails = await Promise.all(
24 admins.map(async m => {
25 try {
26 const user = await workos.userManagement.getUser(m.userId);
27 return user.email || null;
28 } catch {
29 return null;
30 }
31 })
32 );
33
34 return emails.filter((e): e is string => e !== null);
35}

Callers 5

fireDedupNoticeFunction · 0.85
setupRoutesMethod · 0.85
runCheckFunction · 0.85
runDigestFunction · 0.85

Calls 1

getUserMethod · 0.80

Tested by

no test coverage detected