1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::compat::boxed::Box;
use crate::{LocalMessage, Result};
#[async_trait]
pub trait AccessControl: Send + Sync + 'static {
async fn msg_is_authorized(&mut self, local_msg: &LocalMessage) -> Result<bool>;
}
pub struct Passthrough;
#[async_trait]
impl AccessControl for Passthrough {
async fn msg_is_authorized(&mut self, _local_msg: &LocalMessage) -> Result<bool> {
Ok(true)
}
}
pub struct NoAccess;
#[async_trait]
impl AccessControl for NoAccess {
async fn msg_is_authorized(&mut self, _local_msg: &LocalMessage) -> Result<bool> {
Ok(false)
}
}