fix: auth logic (#224)

This commit is contained in:
sigoden
2023-06-02 18:38:59 +08:00
committed by GitHub
parent 1112b936b8
commit 57b4a74279
2 changed files with 30 additions and 1 deletions

View File

@@ -229,8 +229,8 @@ impl AccessPaths {
pub enum AccessPerm {
#[default]
IndexOnly,
ReadWrite,
ReadOnly,
ReadWrite,
}
impl AccessPerm {
@@ -519,4 +519,16 @@ mod tests {
assert_eq!(paths.find("dir2", true), None);
assert!(paths.find("dir1/file", true).is_some());
}
#[test]
fn test_access_paths_perm() {
let mut paths = AccessPaths::default();
assert_eq!(paths.perm(), AccessPerm::IndexOnly);
paths.set_perm(AccessPerm::ReadOnly);
assert_eq!(paths.perm(), AccessPerm::ReadOnly);
paths.set_perm(AccessPerm::ReadWrite);
assert_eq!(paths.perm(), AccessPerm::ReadWrite);
paths.set_perm(AccessPerm::ReadOnly);
assert_eq!(paths.perm(), AccessPerm::ReadWrite);
}
}