get_or_insert_permission_mut returns a mut reference.

Fixes #77.
This commit is contained in:
Zhaofeng Li 2023-08-13 18:23:30 -06:00
parent 4f81255892
commit f4cf5704d6
2 changed files with 2 additions and 2 deletions

View file

@ -85,7 +85,7 @@ pub struct MakeToken {
macro_rules! grant_permissions {
($token:ident, $list:expr, $perm:ident) => {
for pattern in $list {
let mut perm = $token.get_or_insert_permission_mut(pattern.to_owned());
let perm = $token.get_or_insert_permission_mut(pattern.to_owned());
perm.$perm = true;
}
};

View file

@ -67,7 +67,7 @@ pub async fn run_oobe() -> Result<()> {
let in_two_years = Utc::now().checked_add_months(Months::new(24)).unwrap();
let mut token = Token::new("root".to_string(), &in_two_years);
let any_cache = CacheNamePattern::new("*".to_string()).unwrap();
let mut perm = token.get_or_insert_permission_mut(any_cache);
let perm = token.get_or_insert_permission_mut(any_cache);
perm.pull = true;
perm.push = true;
perm.delete = true;