MCPcopy
hub / github.com/stephengpope/thepopebot / requireAdmin

Function requireAdmin

lib/auth/index.js:23–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 * @returns {Promise<{id: string, role: 'admin', ...}>}
22 */
23export async function requireAdmin() {
24 const user = await requireAuth();
25 if (user.role !== 'admin') throw new Error('Forbidden');
26 return user;
27}
28
29/**
30 * Get the auth state for the main page (server component).

Callers 15

getUsersFunction · 0.90
addUserFunction · 0.90
editUserFunction · 0.90
removeUserFunction · 0.90
resetPasswordFunction · 0.90
triggerUpgradeFunction · 0.90
createNewApiKeyFunction · 0.90
deleteApiKeyFunction · 0.90
createOAuthTokenFunction · 0.90
deleteOAuthTokenFunction · 0.90
updateCodingAgentConfigFunction · 0.90
setCodingAgentDefaultFunction · 0.90

Calls 1

requireAuthFunction · 0.70

Tested by

no test coverage detected