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:
@@ -147,12 +147,14 @@ async fn complete(
|
||||
}
|
||||
};
|
||||
let admin = oidc.config.is_admin(&identity);
|
||||
// Bounded, so a hostile or huge claim cannot bloat the session row.
|
||||
let groups: Vec<String> = identity.groups.iter().filter(|g| !g.is_empty() && g.len() <= 128).take(64).cloned().collect();
|
||||
let now = now();
|
||||
let session = state
|
||||
.db
|
||||
.upsert_user(&identity.issuer, &identity.subject, &identity.display_name, now)
|
||||
.map_err(anyhow::Error::from)
|
||||
.and_then(|user_id| state.sessions.create_oidc(&user_id, &identity.display_name, admin, now));
|
||||
.and_then(|user_id| state.sessions.create_oidc(&user_id, &identity.display_name, admin, &groups, now));
|
||||
match session {
|
||||
Ok(session) => {
|
||||
audit(&session.principal(), AuditOutcome::Succeeded);
|
||||
|
||||
Reference in New Issue
Block a user