Skip to main content

authorize

Function authorize 

Source
pub fn authorize(
    ctx: &ReqCtx,
    allowed_roles: &[String],
    resource: &str,
    action: Action<'_>,
) -> bool
Expand description

The one place the access decision is made, so the invariants live together:

  1. Auth unconfigured ⇒ allow (the panel is public while prototyping).
  2. A password-verified but MFA-pending session never passes.

Then: consult the registered Authorizer if there is one, otherwise fall back to the historical allowed_roles ∩ ctx.roles() intersection — so with no authorizer registered this is byte-for-byte the old is_authorized.