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

Function assertCanPromote

apps/sim/lib/workspaces/fork/lineage/authz.ts:132–147  ·  view source on GitHub ↗
(
  currentWorkspaceId: string,
  otherWorkspaceId: string,
  direction: PromoteDirection,
  userId: string
)

Source from the content-addressed store, hash-verified

130 * current -> other; `pull` brings other -> current.
131 */
132export async function assertCanPromote(
133 currentWorkspaceId: string,
134 otherWorkspaceId: string,
135 direction: PromoteDirection,
136 userId: string
137): Promise<PromoteAuthorization> {
138 const edge = await resolveForkEdge(currentWorkspaceId, otherWorkspaceId)
139 if (!edge) {
140 throw new ForkError('These workspaces are not a direct fork edge', 400)
141 }
142 const sourceWorkspaceId = direction === 'push' ? currentWorkspaceId : otherWorkspaceId
143 const targetWorkspaceId = direction === 'push' ? otherWorkspaceId : currentWorkspaceId
144 const source = await assertWorkspaceAdminAccess(sourceWorkspaceId, userId)
145 const target = await assertWorkspaceAdminAccess(targetWorkspaceId, userId)
146 return { edge, source, target, sourceWorkspaceId, targetWorkspaceId }
147}
148
149/** Authorize rolling back the last promote into `targetWorkspaceId` (admin only). */
150export async function assertCanRollback(

Callers 3

route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90

Calls 2

resolveForkEdgeFunction · 0.90

Tested by

no test coverage detected