From: Ian Jackson Date: Sun, 30 May 2021 11:31:48 +0000 (+0100) Subject: sshkeys: Make the access/update functions take an Authorisation X-Git-Tag: otter-0.7.0~221 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=3f943be8e52ec2eae864a0680b1d0dfc59728505;p=otter.git sshkeys: Make the access/update functions take an Authorisation Signed-off-by: Ian Jackson --- diff --git a/src/sshkeys.rs b/src/sshkeys.rs index fd45bf7a..05949a87 100644 --- a/src/sshkeys.rs +++ b/src/sshkeys.rs @@ -191,9 +191,12 @@ macro_rules! def_pskeys_get { def_pskeys_get!{ RecordsExtImm, pskeys_get, get , } def_pskeys_get!{ RecordsExtMut, pskeys_mut, get_mut, mut } +type Auth = Authorisation; + impl AccountsGuard { #[throws(MgmtError)] - pub fn sshkeys_report(&self, acctid: AccountId) -> Vec { + pub fn sshkeys_report(&self, acctid: AccountId, _:Auth) + -> Vec { let accounts = self.get(); let gl = &accounts.ssh_keys; let ps = &accounts.records.pskeys_get(acctid)?; @@ -218,7 +221,7 @@ impl AccountsGuard { // not a good idea to speicfy a problem, but "whatever" #[throws(ME)] pub fn sshkeys_add(&mut self, acctid: AccountId, - new_akl: AuthkeysLine) -> (usize, Id) { + new_akl: AuthkeysLine, _:Auth) -> (usize, Id) { let accounts = self.get_mut(); let gl = &mut accounts.ssh_keys; let ps = accounts.records.pskeys_mut(acctid)?; @@ -267,7 +270,7 @@ impl AccountsGuard { #[throws(ME)] pub fn remove_key(&mut self, acctid: AccountId, - index: usize, id: Id) { + index: usize, id: Id, _:Auth) { let accounts = self.get_mut(); let gl = &mut accounts.ssh_keys; let ps = accounts.records.pskeys_mut(acctid)?;