mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
fix: auth logic (#224)
This commit is contained in:
14
src/auth.rs
14
src/auth.rs
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user