Skip to content

Commit

Permalink
chore(plugin): use BTreeMap on plugin permission map (#8668)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Jan 24, 2024
1 parent 1878766 commit 4ca0932
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/tauri-utils/src/acl/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! Plugin ACL types.

use std::{collections::HashMap, num::NonZeroU64};
use std::{collections::BTreeMap, num::NonZeroU64};

use super::{Permission, PermissionSet};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -50,18 +50,18 @@ pub struct Manifest {
/// Default permission.
pub default_permission: Option<PermissionSet>,
/// Plugin permissions.
pub permissions: HashMap<String, Permission>,
pub permissions: BTreeMap<String, Permission>,
/// Plugin permission sets.
pub permission_sets: HashMap<String, PermissionSet>,
pub permission_sets: BTreeMap<String, PermissionSet>,
}

impl Manifest {
/// Creates a new manifest from a list of permission files.
pub fn from_files(permission_files: Vec<PermissionFile>) -> Self {
let mut manifest = Self {
default_permission: None,
permissions: HashMap::new(),
permission_sets: HashMap::new(),
permissions: BTreeMap::new(),
permission_sets: BTreeMap::new(),
};

for permission_file in permission_files {
Expand All @@ -80,7 +80,7 @@ impl Manifest {
.permission
.into_iter()
.map(|p| (p.identifier.clone(), p))
.collect::<HashMap<_, _>>(),
.collect::<BTreeMap<_, _>>(),
);

manifest.permission_sets.extend(
Expand All @@ -97,7 +97,7 @@ impl Manifest {
},
)
})
.collect::<HashMap<_, _>>(),
.collect::<BTreeMap<_, _>>(),
);
}

Expand Down

0 comments on commit 4ca0932

Please sign in to comment.