MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / withAdminAuth

Function withAdminAuth

web/src/app/api/admin/admin-auth.ts:38–50  ·  view source on GitHub ↗
(
  handler: (adminUser: utils.AdminUser, ...args: T) => Promise<NextResponse>,
)

Source from the content-addressed store, hash-verified

36 * Higher-order function to wrap admin API routes with authentication
37 */
38export function withAdminAuth<T extends any[]>(
39 handler: (adminUser: utils.AdminUser, ...args: T) => Promise<NextResponse>,
40) {
41 return async (...args: T): Promise<NextResponse> => {
42 const authResult = await checkAdminAuth()
43
44 if (authResult instanceof NextResponse) {
45 return authResult // Return the error response
46 }
47
48 return handler(authResult, ...args)
49 }
50}

Callers

nothing calls this directly

Calls 1

checkAdminAuthFunction · 0.70

Tested by

no test coverage detected