( workspaceId: string, userId: string )
| 70 | |
| 71 | /** Require admin access; returns the (active) workspace. */ |
| 72 | export async function assertWorkspaceAdminAccess( |
| 73 | workspaceId: string, |
| 74 | userId: string |
| 75 | ): Promise<WorkspaceWithOwner> { |
| 76 | const { workspace, canAdmin } = await requireWorkspace(workspaceId, userId) |
| 77 | if (!canAdmin) { |
| 78 | throw new ForkError('Admin access is required for this workspace', 403) |
| 79 | } |
| 80 | return workspace |
| 81 | } |
| 82 | |
| 83 | export interface ForkAuthorization { |
| 84 | source: WorkspaceWithOwner |
no test coverage detected