MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / requireIsAdmin

Function requireIsAdmin

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

Source from the content-addressed store, hash-verified

111};
112
113export const requireIsAdmin = async (ctx: TRPCContext) => {
114 ctx.markAccessControlRun();
115
116 const userId = requireUserId(ctx);
117
118 if (!(await isAdmin(userId))) {
119 throw new TRPCError({
120 code: "UNAUTHORIZED",
121 message: "You must be an admin to perform this action.",
122 });
123 }
124};
125
126export const accessChecks = {
127 requireNothing,

Calls 2

requireUserIdFunction · 0.85
isAdminFunction · 0.85

Tested by

no test coverage detected