The Super Admin system provides administrative capabilities to authorized users only. This document outlines the purpose, implementation, and usage of super admin features.
Super admin access is controlled by an environment variable:
This environment variable should be set to the email address of the user who should have super admin privileges. If not set, the system will default to a hardcoded email in production (ayoelutilo@gmail.com).
Currently, the super admin has access to:
WordPress Cache Management
System Information (planned)
Admin Settings (planned)
Super admin status is determined by comparing the currently logged-in user's email address with the configured super admin email. This check is performed both on the server-side (for API endpoints) and client-side (for UI elements).
The WordPress cache clearing functionality leverages the existing cache invalidation system:
/api/admin/clear-wordpress-cache validates the user is a super admininvalidatePostsCache() functionPlanned enhancements for the admin system include:
To test super admin features:
SUPER_ADMIN_EMAIL environment variableSUPER_ADMIN_EMAIL=your_email@example.com// Utility function to check super admin statusexport function isSuperAdmin(email: string | undefined | null): boolean { if (!email) return false const superAdminEmail = process.env.SUPER_ADMIN_EMAIL if (!superAdminEmail) { return process.env.NODE_ENV === 'production' ? email === 'ayoelutilo@gmail.com' : false } return email === superAdminEmail}