mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
29 lines
677 B
Rust
29 lines
677 B
Rust
use filestash::*;
|
|
|
|
#[derive(Default)]
|
|
pub struct Plugin;
|
|
|
|
impl Authorisation for Plugin {
|
|
fn ls(&self, _ctx: &impl Context, path: &str) -> Decision {
|
|
self.check(path)
|
|
}
|
|
fn cat(&self, _ctx: &impl Context, path: &str) -> Decision {
|
|
self.check(path)
|
|
}
|
|
fn stat(&self, _ctx: &impl Context, path: &str) -> Decision {
|
|
self.check(path)
|
|
}
|
|
}
|
|
|
|
impl Plugin {
|
|
fn check(&self, path: &str) -> Decision {
|
|
if path.split("/").any(|segment| segment == "top_secret") {
|
|
log::warn!("[TOPSECRET] access denied !!");
|
|
return Decision::Deny;
|
|
}
|
|
Decision::Allow
|
|
}
|
|
}
|
|
|
|
register!(Plugin: Authorisation);
|