Files
coa-server-manager/crates/coa-core/examples/ra_account.rs
T
ДмитрийandClaude Sonnet 5.5 d0794d49f8 Phase 6a: tracked SQL migration runner (ledger, baseline from core updates table, destructive backup gate, ordered by git introduction)
Verified on the fixture: 608 real core/module SQL scripts applied through the runner,
world reaches 'ready', account created over RA with administrator rights.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 09:05:31 +05:00

13 lines
792 B
Rust

//! Create an account through the Manager's RA client on a RUNNING disposable fixture.
fn main() {
let a: Vec<String> = std::env::args().skip(1).collect();
assert!(a[0].to_lowercase().contains("fixture"), "refusing: not a fixture folder");
let root = std::path::Path::new(&a[0]);
let mut ra = coa_core::ra::Ra::connect(root).expect("connect");
ra.create_account(&a[1], &a[2]).expect("create");
ra.make_administrator(&a[1]).expect("gm");
println!("created {} (administrator)", a[1]);
let out = coa_core::backup::with_database(root, |db| db.query(&format!("SELECT a.username, aa.gmlevel FROM acore_auth.account a LEFT JOIN acore_auth.account_access aa ON aa.id=a.id WHERE a.username='{}';", a[1].to_uppercase()))).unwrap();
println!("in database: {out}");
}