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

@@ -673,3 +673,22 @@ async fn a_target_that_is_the_source_or_a_production_database_is_refused_when_th
assert_eq!(lab.run(&run).blocked_reason.as_deref(), Some("target_matches_a_production_source"));
assert_eq!(lab.restore_jobs(), 0);
}
#[tokio::test]
async fn someone_who_may_only_refresh_gets_into_the_app_but_sees_nothing_else() {
let lab = fresh().await;
let nobody = lab.person("nobody");
let status = lab.send(&nobody, "GET", "/api/v1/operator/session", None).await.1;
assert_eq!((status["authorized"].clone(), status["admin"].clone()), (json!(false), json!(false)), "no grant at all: closed");
let (qa, _) = lab.refresher("qa");
let status = lab.send(&qa, "GET", "/api/v1/operator/session", None).await.1;
assert_eq!((status["authorized"].clone(), status["admin"].clone()), (json!(true), json!(false)), "a relation grant opens the app");
let me = lab.send(&qa, "GET", "/api/v1/me", None).await.1;
assert_eq!(me["refresh_relations"], json!([lab.relation.clone()]));
assert_eq!(me["grants"].as_array().unwrap().len(), 0, "and carries no orbit permission");
// nothing about orbits, snapshots or restores is visible to them
for path in ["/api/v1/orbits", "/api/v1/snapshots", "/api/v1/capture-jobs", "/api/v1/restore-jobs", "/api/v1/relations"] {
assert_eq!(lab.send(&qa, "GET", path, None).await.0, StatusCode::FORBIDDEN, "{path}");
}
assert_eq!(lab.send(&qa, "GET", "/api/v1/refresh-relations", None).await.0, StatusCode::OK);
}