Skip to content

Multi site: Guard ListSites in PageHeader behind site:read #563

Description

@flesher

Follow-up from PR #562 review (thread), split out so it doesn't block graduating the MULTI_SITE_ENABLED flag.

Problem

PageHeader is mounted by AppLayout on all normal authenticated pages. After the multi-site flag removal, its fetchSites() effect runs unconditionally. ListSites is server-gated on org-scoped site:read, so a user lacking that permission (e.g. the built-in FIELD_TECH role) gets PermissionDenied, and the top bar renders SitePicker's "Sites unavailable" retry affordance everywhere. FleetLayout already hides site-backed tabs for the same case, so the header is inconsistent with the rest of the UI.

Proposed fix

Gate the fetch and SitePicker render on useHasPermission("site:read"), and initialize sites to [] when the user is blocked, so non-site readers keep a clean header.

Notes

  • FleetLayout already does the analogous gating (canReadSites, with a [] initial state when blocked) — mirror that pattern.
  • File: client/src/protoFleet/components/PageHeader/PageHeader.tsx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions