MCPcopy
hub / github.com/OpenPipe/OpenPipe / requireUserId

Function requireUserId

app/src/utils/accessControl.ts:14–22  ·  view source on GitHub ↗
(ctx: TRPCContext)

Source from the content-addressed store, hash-verified

12};
13
14const requireUserId = (ctx: TRPCContext) => {
15 if (!ctx.session?.user.id) {
16 throw new TRPCError({
17 code: "UNAUTHORIZED",
18 message: "This function is only available to signed-in users.",
19 });
20 }
21 return ctx.session.user.id;
22};
23
24// No-op method for protected routes that really should be accessible to anyone.
25export const requireNothing = (ctx: TRPCContext) => {

Callers 4

requireCanViewProjectFunction · 0.85
requireCanModifyProjectFunction · 0.85
requireIsProjectAdminFunction · 0.85
requireIsAdminFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected