MCPcopy Index your code
hub / github.com/simstudioai/sim / isOrganizationAdminOrOwner

Function isOrganizationAdminOrOwner

apps/sim/lib/workspaces/permissions/utils.ts:406–416  ·  view source on GitHub ↗
(
  userId: string,
  organizationId: string
)

Source from the content-addressed store, hash-verified

404 * @returns Promise<boolean> - True when the user is the organization owner or an admin
405 */
406export async function isOrganizationAdminOrOwner(
407 userId: string,
408 organizationId: string
409): Promise<boolean> {
410 const [row] = await db
411 .select({ role: member.role })
412 .from(member)
413 .where(and(eq(member.userId, userId), eq(member.organizationId, organizationId)))
414 .limit(1)
415 return isOrgAdminRole(row?.role)
416}
417
418/**
419 * Check whether a user is a member (any role) of a specific organization.

Callers 3

route.tsFile · 0.90

Calls 2

isOrgAdminRoleFunction · 0.85
eqFunction · 0.50

Tested by

no test coverage detected