pub fn user<U>(cx: &Cx) -> Option<&U>where
U: PanelUser,Expand description
The signed-in user, as the app’s own user type.
None when nobody is signed in to the request’s panel, and when the
panel’s Authenticator loads another type than U — a helper shared by
two panels with different user types answers None on the other one.
When no mounted panel’s authenticator loads U, that U can only answer None, so every
check through it denies: the first such call logs an error naming U and the types the panels
load. Debug and release builds behave alike.
fn admins_only(cx: &Cx) -> bool {
auth::user::<Staff>(cx).is_some_and(|staff| staff.admin)
}