MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / requireAdmin

Function requireAdmin

packages/trpc/src/routers/subscription.ts:24–29  ·  view source on GitHub ↗
(userId: string, organizationId: string)

Source from the content-addressed store, hash-verified

22import { createTRPCRouter, protectedProcedure } from '../trpc';
23
24async function requireAdmin(userId: string, organizationId: string) {
25 const access = await getOrganizationAccess({ userId, organizationId });
26 if (access?.role !== 'org:admin') {
27 throw new TRPCForbiddenError('Only organization admins can manage billing');
28 }
29}
30
31export const subscriptionRouter = createTRPCRouter({
32 getCurrent: protectedProcedure

Callers 1

subscription.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected