Skip to main content

is_permitted

Function is_permitted 

Source
pub async fn is_permitted(
    conn: &mut PgConnection,
    action: Action,
    resource: Resource,
    user_roles: &[Role],
) -> Result<bool, AuthorizationError>
Expand description

Whether user_roles allow action on resource.

The boolean answer for callers that ask a permission question instead of gating on it: a denial costs no error, and therefore no backtrace, span trace or roles dump. Errors only when the check itself cannot be completed.