MCPcopy
hub / github.com/codeaashu/claude-code / requireAdmin

Function requireAdmin

src/server/web/admin.ts:17–24  ·  view source on GitHub ↗

* Admin dashboard routes. * * All routes under /admin require the requesting user to have isAdmin = true. * The caller (pty-server.ts) is responsible for applying the auth middleware * before mounting this router.

(req: Request, res: Response, next: () => void)

Source from the content-addressed store, hash-verified

15 */
16
17function requireAdmin(req: Request, res: Response, next: () => void): void {
18 const user = (req as AuthenticatedRequest).user;
19 if (!user?.isAdmin) {
20 res.status(403).json({ error: "Forbidden" });
21 return;
22 }
23 next();
24}
25
26export function createAdminRouter(
27 sessionManager: SessionManager,

Callers

nothing calls this directly

Calls 2

nextFunction · 0.85
statusMethod · 0.80

Tested by

no test coverage detected