feat: refresh console for QA and refresh-only access (auth M6d)

- web: Refresh console (relation cards, overwrite confirmation, progress,
  cancel, distinct failure messages), rail item, and a single-screen view
  for people who may only refresh
- hub: refresh-only users are authorized; /me exposes refresh_relations
- docs and auth plan record the real rehearsal (Postgres, agent, Keycloak,
  browser) and what was not verified

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 19:03:47 +07:00
parent da46453c13
commit d7fe99edd7
9 changed files with 310 additions and 10 deletions

View File

@@ -23,12 +23,19 @@ function useSsoError() {
/** What the signed-in user may do. The hub enforces it; this only decides what is worth showing. */
export type Caps = {
admin: boolean;
/** Holds at least one orbit permission (so the vault screens have something to show). */
orbits: boolean;
/** May start a refresh through at least one relation (administrators always may). */
refresh: boolean;
can: (permission: string, orbitId?: string) => boolean;
};
export function capsFrom(me: Me | undefined, admin: boolean): Caps {
return {
admin,
orbits: admin || (Array.isArray(me?.grants) && me.grants.length > 0),
// An old hub that sends no relations leaves this to the administrator flag.
refresh: admin || (Array.isArray(me?.refresh_relations) && me.refresh_relations.length > 0),
can: (permission, orbitId) =>
// A hub or mock that does not send grants simply grants nothing here; the server decides anyway.
admin || (Array.isArray(me?.grants) && me.grants.some((g) => g.permission === permission && (g.orbit_id === null || g.orbit_id === orbitId))),