From 84bc3e19777560c8220cbfbbef4f36cf9e88a7b4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 23 Oct 2020 23:49:17 +0100 Subject: [PATCH] wip new account etc. Signed-off-by: Ian Jackson --- src/accounts.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/accounts.rs b/src/accounts.rs index fb312ae7..2f5feb1e 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -179,7 +179,7 @@ impl AccountRecord { where F: FnOnce(Option<&mut AccountRecord>) -> T { let entry = AccountRecord::lookup_mut_caller_must_save(account, auth); - let output = f(*entry); + let output = f(entry.as_deref_mut()); let ok = if entry.is_some() { save_accounts_now() } else { Ok(()) }; match ok { Ok(()) => Ok(output), @@ -216,8 +216,8 @@ pub mod loaded_acl { #[derive(Debug,Clone)] #[derive(Serialize,Deserialize)] - #[serde(from="Acl")] - #[serde(into="Acl")] + #[serde(from="Acl

")] + #[serde(into="Acl

")] pub struct LoadedAcl (Vec>); impl Default for LoadedAcl

{ @@ -257,21 +257,21 @@ pub mod loaded_acl { -> Authorisation { let mut needed = p.0; assert!(needed != 0); - let test_existence = P::test_existence().to_primitive(); + let test_existence = P::TEST_EXISTENCE.to_u64().unwrap(); needed |= test_existence; - for AclEntryRef { pat, allow, deny } in self.entries() { + for AclEntryRef { pat, allow, deny, .. } in self.entries() { if !match pat { Left(owner) => owner == subject, Right(pat) => pat.matches(subject), } { continue } if needed & deny != 0 { break } if allow != 0 { needed &= !(allow | test_existence) } - if needed == 0 { return Ok(Authorisation::authorise_any()) } + if needed == 0 { return Authorisation::authorise_any() } } - Err(if needed & test_existence != 0 { + throw!(if needed & test_existence != 0 { P::NOT_FOUND } else { - MgmtError::PermissionDenied + MgmtError::AuthorisationError }) } } -- 2.30.2