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

Function assertIsUser

packages/api/src/utils/permissions.ts:219–228  ·  view source on GitHub ↗
(ctx: Context, targetUserId: string)

Source from the content-addressed store, hash-verified

217export const NOT_AUTHORIZED_MESSAGE = 'You are not authorized to do this';
218
219export function assertIsUser(ctx: Context, targetUserId: string) {
220 if (isSuperUser(ctx)) return;
221 if (ctx.discordAccount?.id !== targetUserId) {
222 return new TRPCError({
223 code: 'UNAUTHORIZED',
224 message: NOT_AUTHORIZED_MESSAGE,
225 });
226 }
227 return;
228}
229export const INVALID_ROUTE_FOR_BOT_ERROR =
230 'This route is unavailable to be called from the bot';
231export const INVALID_ROUTER_FOR_WEB_CLIENT_ERROR =

Callers 2

mutateUserServerSettingsFunction · 0.90

Calls 1

isSuperUserFunction · 0.85

Tested by

no test coverage detected