modkit_security/
policy_engine.rs1use crate::SecurityContext;
2
3pub type PolicyEngineRef = std::sync::Arc<dyn PolicyEngine>;
5
6pub trait PolicyEngine: Send + Sync {
8 fn allows(&self, ctx: &SecurityContext, resource: &str, action: &str) -> bool;
9}
10
11pub struct NoopPolicyEngine;
12
13impl Default for NoopPolicyEngine {
14 fn default() -> Self {
15 NoopPolicyEngine
16 }
17}
18
19impl PolicyEngine for NoopPolicyEngine {
20 fn allows(&self, _ctx: &SecurityContext, _resource: &str, _action: &str) -> bool {
21 true
22 }
23}