feat: environments and production-to-staging relations (auth M6b)
- environment (production/staging/development) on source orbits and on restore targets; an unlabelled target fails closed and a production target is refused - directed, versioned relations from a managed source orbit to a restore target: one active relation per pair, retargeting makes a new id and ends the old one - refusals name the rule: unknown or unlabelled source/target, not a managed capture profile, not restore-ready, application or engine mismatch, inactive Outpost, and a target whose identity matches a database captured as production in any snapshot - relations end in the same transaction when their target is relabelled production or an Outpost is revoked; usability is re-read live - refresh.run is granted per relation id in its own table (user or group, expiry), never global, never carried to a new version, and never accepted by the orbit gate - admin API under /api/v1/relations plus environment endpoints; people holding only a relation grant see names and environments, never identity, host, Outpost or application - Relations console; sign-in form without SSO no longer shows a stray "Details" label Tests extend the access matrix with relation fixtures and a caller that holds only a relation grant. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -239,6 +239,13 @@ impl Db {
|
||||
params![outpost, now],
|
||||
)?;
|
||||
let known = tx.execute("UPDATE outposts SET pairing_state='revoked' WHERE id=?1", params![outpost])? == 1;
|
||||
// Anything that overwrites through, or reads from, this Outpost must stop working with it.
|
||||
tx.execute(
|
||||
"UPDATE orbit_relations SET active=0, deactivated_at=?2, deactivated_reason='outpost_revoked'
|
||||
WHERE active=1 AND (target_id IN (SELECT id FROM restore_targets WHERE outpost_id=?1)
|
||||
OR source_application_id IN (SELECT application_id FROM capture_profiles WHERE outpost_id=?1))",
|
||||
params![outpost, now],
|
||||
)?;
|
||||
tx.commit()?;
|
||||
Ok(known)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user