pub async fn access_context(pool: &Pool, viewer: Option<&User>) -> AccessContextExpand description
Build the per-render AccessContext for viewer: load every
tenant restriction (+ the restricted pages’ paths) and per-type
restriction, and resolve the viewer’s codenames + role ids. Bounded,
fixed number of queries; the viewer lookups are skipped entirely when
nothing is gated or the viewer is a superuser.
When the restrictions can’t be read the context hides every page from everyone but superusers: a menu or search result must not list a gated page’s title and URL because the lookup failed.