AdminGuard
Corex\Security\Admin\AdminGuard · class · Core layer
The single capability + nonce gate for Corex admin-menu screens. Principle VII’s declarative middleware governs Corex routes (the REST/AJAX controller lifecycle, which carry a Request/Response through the Pipeline). WordPress admin-menu screens are a different lifecycle — admin_menu/admin_init page callbacks with no Corex Request — so they are exempt from that pipeline. To keep them from hand-rolling security per screen, every admin screen routes its cap + nonce check through this one helper instead. (DECISIONS #58.)
Public API
Section titled “Public API”authorized(string $capability): bool
Section titled “authorized(string $capability): bool”Whether the current user holds the capability (default: site administration).
verifiedPost(string $field, string $action, string $capability): bool
Section titled “verifiedPost(string $field, string $action, string $capability): bool”True only when the current user is authorized AND the POST carries a valid nonce for $action in the $field key. The gate an admin screen calls before acting on a submission — so the unslash + sanitize + verify dance lives in exactly one place.