Skip to content

Commit 65787d7

Browse files
authored
fix(api-keys): remove billed account check during api key generation (#2476)
1 parent 656a6b8 commit 65787d7

File tree

1 file changed

+0
-34
lines changed
  • apps/sim/app/api/workspaces/[id]/api-keys

1 file changed

+0
-34
lines changed

apps/sim/app/api/workspaces/[id]/api-keys/route.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,6 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
9898
return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
9999
}
100100

101-
const workspaceRows = await db
102-
.select({ billedAccountUserId: workspace.billedAccountUserId })
103-
.from(workspace)
104-
.where(eq(workspace.id, workspaceId))
105-
.limit(1)
106-
107-
if (!workspaceRows.length) {
108-
return NextResponse.json({ error: 'Workspace not found' }, { status: 404 })
109-
}
110-
111-
if (workspaceRows[0].billedAccountUserId !== userId) {
112-
return NextResponse.json(
113-
{ error: 'Only the workspace billing account can create workspace API keys' },
114-
{ status: 403 }
115-
)
116-
}
117-
118101
const body = await request.json()
119102
const { name } = CreateKeySchema.parse(body)
120103

@@ -202,23 +185,6 @@ export async function DELETE(
202185
return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
203186
}
204187

205-
const workspaceRows = await db
206-
.select({ billedAccountUserId: workspace.billedAccountUserId })
207-
.from(workspace)
208-
.where(eq(workspace.id, workspaceId))
209-
.limit(1)
210-
211-
if (!workspaceRows.length) {
212-
return NextResponse.json({ error: 'Workspace not found' }, { status: 404 })
213-
}
214-
215-
if (workspaceRows[0].billedAccountUserId !== userId) {
216-
return NextResponse.json(
217-
{ error: 'Only the workspace billing account can delete workspace API keys' },
218-
{ status: 403 }
219-
)
220-
}
221-
222188
const body = await request.json()
223189
const { keys } = DeleteKeysSchema.parse(body)
224190

0 commit comments

Comments
 (0)