Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

524 B
Raw Blame
import { HTTPException } from "hono/http-exception";
import { findInaccessibleProjectIds } from "./find-inaccessible-project-ids";

export async function assertProjectAccess(
  userId: string,
  projectIds: string | readonly string[],
): Promise<void> {
  const ids = typeof projectIds === "string" ? [projectIds] : projectIds;
  const denied = await findInaccessibleProjectIds(userId, ids);
  if (denied.length > 0) {
    throw new HTTPException(403, {
      message: "You don't have access to this project",
    });
  }
}