(r, auth)
}
+ #[throws(MgmtError)]
+ fn start_access_ssh_keys(cs: &CommandStreamData)
+ -> (AccountsGuard, AccountId, Authorisation<AccountScope>)
+ {
+ let ag = AccountsGuard::lock();
+ let wanted = &cs.current_account()?.notional_account;
+ let acctid = ag.check(wanted)?;
+ let auth = authorise_scope_direct(cs, &ag, &wanted.scope)?;
+ (ag, acctid, auth)
+ }
+
let resp = (|| Ok::<_,MgmtError>(match cmd {
MC::Noop => Fine,
MR::LibraryItems(results)
}
+ MC::SshListKeys => {
+ let (ag, acctid, auth) = start_access_ssh_keys(&cs)?;
+ let list = ag.sshkeys_report(acctid, auth)?;
+ MR::SshKeys(list)
+ }
+ MC::SshAddKey { akl } => {
+ let (mut ag, acctid, auth) = start_access_ssh_keys(&cs)?;
+ let (index, id) = ag.sshkeys_add(acctid, akl, auth)?;
+ MR::SshKey { index, id }
+ }
+ MC::SshDeleteKey { index, id } => {
+ let (mut ag, acctid, auth) = start_access_ssh_keys(&cs)?;
+ ag.sshkeys_remove(acctid, index, id, auth)?;
+ MR::Fine
+ }
+
MC::LoadFakeRng(ents) => {
let superuser = cs.superuser()
.ok_or(ME::SuperuserAuthorisationRequired)?;
pat: String,
},
+ SshListKeys,
+ SshAddKey { akl: sshkeys::AuthkeysLine },
+ SshDeleteKey { index: usize, id: sshkeys::Id },
+
LoadFakeRng(Vec<String>),
}
LibraryItems(Vec<ItemEnquiryData>),
Bundles { bundles: MgmtBundleList },
Bundle { bundle: bundles::Id },
+ SshKeys(Vec<sshkeys::MgmtKeyReport>),
+ SshKey { index: usize, id: sshkeys::Id },
}
pub type MgmtBundleList = BTreeMap<bundles::Id, bundles::State>;
Progress(_) => panic!(),
Fine | AccountsList{..} | GamesList{..} |
Libraries(_) | LibraryItems(_) | Bundles{..} | Bundle{..} => { },
+ SshKeys(..) | SshKey{..} => { },
AlterGame { error: None, .. } => { },
Error { error } => {
Err(error.clone()).context(