Skip to main content

require_admin

Function require_admin 

Source
pub fn require_admin(infra: &InfraContext<'_>, token: &str) -> Result<(), Error>
Expand description

Return Ok(()) when the caller is admin (on OpenCHAMI, always); Err(Error::Forbidden(...)) (a 403) otherwise.

Use at handler boundaries that restrict an operation to admin users. Centralises the check so a future policy change (e.g. a different admin-role name, or audit-logging on admin access) touches one place.