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

Function getWorkspaceWithOwner

apps/sim/lib/workspaces/permissions/utils.ts:82–106  ·  view source on GitHub ↗
(
  workspaceId: string,
  options?: { includeArchived?: boolean }
)

Source from the content-addressed store, hash-verified

80 * @returns The workspace with owner info if found, null otherwise
81 */
82export async function getWorkspaceWithOwner(
83 workspaceId: string,
84 options?: { includeArchived?: boolean }
85): Promise<WorkspaceWithOwner | null> {
86 const { includeArchived = false } = options ?? {}
87 const [ws] = await db
88 .select({
89 id: workspace.id,
90 name: workspace.name,
91 ownerId: workspace.ownerId,
92 organizationId: workspace.organizationId,
93 workspaceMode: workspace.workspaceMode,
94 billedAccountUserId: workspace.billedAccountUserId,
95 archivedAt: workspace.archivedAt,
96 })
97 .from(workspace)
98 .where(
99 includeArchived
100 ? eq(workspace.id, workspaceId)
101 : and(eq(workspace.id, workspaceId), isNull(workspace.archivedAt))
102 )
103 .limit(1)
104
105 return ws || null
106}
107
108/**
109 * Resolve the effective workspace permission for a user under the governance

Callers 15

archiveWorkspaceFunction · 0.90
utils.test.tsFile · 0.90
buildWorkspaceMdDataFunction · 0.90
materializeMethod · 0.90
acceptInvitationFunction · 0.90
restoreWorkspaceFileFunction · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
getUserPermissionConfigFunction · 0.90
restoreWorkflowFunction · 0.85

Calls 1

eqFunction · 0.50

Tested by

no test coverage detected