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

Function assertIsUserInServer

packages/api/src/utils/permissions.ts:159–175  ·  view source on GitHub ↗
(ctx: Context, targetServerId: string)

Source from the content-addressed store, hash-verified

157}
158
159export function assertIsUserInServer(ctx: Context, targetServerId: string) {
160 if (isSuperUser(ctx)) return;
161 if (!ctx.userServers) {
162 return new TRPCError({
163 code: 'UNAUTHORIZED',
164 message: 'Sign in to view this server',
165 });
166 }
167 const server = ctx.userServers.find((server) => server.id === targetServerId);
168 if (!server) {
169 return new TRPCError({
170 code: 'UNAUTHORIZED',
171 message: 'You are not a part of this server',
172 });
173 }
174 return;
175}
176
177export async function assertIsNotIgnoredAccount(
178 ctx: Context,

Callers

nothing calls this directly

Calls 1

isSuperUserFunction · 0.85

Tested by

no test coverage detected