feat: per-orbit access grants and an Access console (auth M5)

Authorization
- one gate for every human endpoint: authenticate, resolve the resource, then
  admin_only / scoped / visible; require_admin* removed so each handler must choose
- grants (user or IdP group; global or one orbit; optional end date) read live on
  every request; only orbit.read, snapshot.read, capture.run and snapshot.download
  can be granted, everything else stays with configured administrators
- an orbit without orbit.read is 404, a visible one without the permission is 403,
  a caller with nothing to see gets 403 on lists; job history is filtered before LIMIT
- jobs and audit record the stable principal id, not the IdP display name
- restore targets and restore history are admin-only until self-service (M6)
- sessions keep the groups verified at sign-in

Administration
- /api/v1/access grants and users (enable, disable, sign out everywhere), validated
  and audited by id; admins cannot disable themselves or the emergency operator
- Access console with the shared Select and a themed DatePicker; non-administrators
  only see Vault and Activity and never call administrator endpoints
- the Window/Radar view is stored per account (/api/v1/me/preferences)
- UI tolerates older hubs and mocks (missing admin/grants) and a console that fails
  to render no longer blanks the app

Tests: a matrix generated from the endpoint contract exercises every human route
against real resources in two orbits for each kind of caller.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 14:45:41 +07:00
parent 54abd02250
commit d12472ba02
29 changed files with 2284 additions and 169 deletions

View File

@@ -1025,3 +1025,31 @@ button.act-row[data-group="needs"]:hover { background: #20161a; }
.act-state { grid-column: 3; grid-row: 1; flex-direction: row; align-items: center; gap: 8px; }
.act-open { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
}
/* Date field: the calendar shares the select list's surface so every popover on a console looks alike. */
.select-value[data-placeholder] { color: var(--quiet); }
.datepicker {
position: fixed; z-index: 80; width: 284px; box-sizing: border-box; padding: 10px;
background: #111418; border: 1px solid #3a3f46; border-radius: 9px;
box-shadow: 0 18px 50px #000c, inset 0 1px 0 #ffffff10;
}
.datepicker-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 8px; font: 500 13px var(--font-sans); color: var(--color-star-100); }
.datepicker-head button, .datepicker-foot button {
min-width: 32px; height: 32px; padding: 0 10px; border: 1px solid #2f343b; border-radius: 6px; background: #14171b;
color: var(--color-star-200); font: 13px var(--font-sans); cursor: pointer;
}
.datepicker-head button:hover:not(:disabled), .datepicker-foot button:hover:not(:disabled) { border-color: #5a6068; color: var(--color-star-100); }
.datepicker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.datepicker-weekday { padding: 4px 0; text-align: center; font: 500 9.5px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--quiet); }
.datepicker-grid button {
height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--color-star-200);
font: 13px var(--font-sans); cursor: pointer;
}
.datepicker-grid button[data-outside] { color: #5d636c; }
.datepicker-grid button[data-today] { box-shadow: inset 0 0 0 1px #4a4f57; }
.datepicker-grid button:hover:not(:disabled) { background: #1e1c20; color: var(--color-star-100); }
.datepicker-grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.datepicker-grid button[aria-selected="true"] { background: #2a2118; color: #ffd0a9; box-shadow: inset 0 0 0 1px var(--accent); }
.datepicker-grid button:disabled { opacity: .35; cursor: default; }
.datepicker-foot { display: flex; justify-content: space-between; padding-top: 8px; }
.datepicker-foot button:disabled { opacity: .4; cursor: default; }