⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
refactor(api): reorganize workspace access validation logic
Andrej Acevskia3fc90f2228a
diff --git a/apps/api/src/utils/validate-workspace-access.ts b/apps/api/src/utils/validate-workspace-access.tsindex 49abee1e4..70f44f7ee 100644--- a/apps/api/src/utils/validate-workspace-access.ts+++ b/apps/api/src/utils/validate-workspace-access.ts@@ -7,23 +7,6 @@ export async function validateWorkspaceAccess(workspaceId: string,apiKeyId?: string,): Promise<void> {- const membership = await db- .select()- .from(schema.workspaceUserTable)- .where(- and(- eq(schema.workspaceUserTable.userId, userId),- eq(schema.workspaceUserTable.workspaceId, workspaceId),- ),- )- .limit(1);-- if (membership.length === 0) {- throw new HTTPException(403, {- message: "You don't have access to this workspace",- });- }-if (apiKeyId) {const apiKey = await db.select()@@ -43,4 +26,21 @@ export async function validateWorkspaceAccess(});}}++ const membership = await db+ .select()+ .from(schema.workspaceUserTable)+ .where(+ and(+ eq(schema.workspaceUserTable.userId, userId),+ eq(schema.workspaceUserTable.workspaceId, workspaceId),+ ),+ )+ .limit(1);++ if (membership.length === 0) {+ throw new HTTPException(403, {+ message: "You don't have access to this workspace",+ });+ }}