Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

check share overview before throwing access error

Carl-Gerhard Lindesvärdf61527818907
diff --git a/packages/trpc/src/routers/chart.ts b/packages/trpc/src/routers/chart.ts
index 8d1bafa81..707bdea09 100644
--- a/packages/trpc/src/routers/chart.ts
+++ b/packages/trpc/src/routers/chart.ts
@@ -159,7 +159,15 @@ export const chartRouter = createTRPCRouter({
userId: ctx.session.userId,
});
if (!access) {
- throw TRPCAccessError('You do not have access to this project');
+ const share = await db.shareOverview.findFirst({
+ where: {
+ projectId: input.projectId,
+ },
+ });
+
+ if (!share) {
+ throw TRPCAccessError('You do not have access to this project');
+ }
}
} else {
const share = await db.shareOverview.findFirst({