MCPcopy Index your code
hub / github.com/AnswerOverflow/AnswerOverflow / assertIsOnPlan

Function assertIsOnPlan

packages/api/src/utils/permissions.ts:136–146  ·  view source on GitHub ↗
(server: ServerWithFlags, plans: Plan[])

Source from the content-addressed store, hash-verified

134}
135
136export function assertIsOnPlan(server: ServerWithFlags, plans: Plan[]) {
137 if (!plans.some((plan) => plan === server.plan)) {
138 return new TRPCError({
139 code: 'FORBIDDEN',
140 message: `You are not on the correct plan to do this. You are on the ${
141 server.plan
142 } plan, but you need to be on the ${plans.join(' or ')} plan`,
143 });
144 }
145 return;
146}
147
148export function assertCanEditMessage(ctx: Context, authorId: string) {
149 if (isSuperUser(ctx)) return;

Callers 2

server.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected