mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2026-03-30 15:34:43 -04:00
feat: added basic ACL functionality
This commit is contained in:
parent
6a9f8dfa6f
commit
7562925aeb
13 changed files with 183 additions and 4 deletions
25
src/service/acl/data.rs
Normal file
25
src/service/acl/data.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use serde::{Serialize, Deserialize};
|
||||
use url::Host;
|
||||
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
/// check if given host exists in Acls, if so return it
|
||||
fn check_acl(&self,host: &Host<String> ) -> crate::Result<Option<AclMode>>;
|
||||
|
||||
/// add a given Acl entry to the database
|
||||
fn add_acl(&self, acl: AclDatabaseEntry) -> crate::Result<()>;
|
||||
/// remove a given Acl entry from the database
|
||||
fn remove_acl(&self,host: Host<String>) -> crate::Result<()>;
|
||||
}
|
||||
|
||||
#[derive(Serialize,Deserialize, Debug, Clone, Copy)]
|
||||
pub enum AclMode{
|
||||
Block,
|
||||
Allow
|
||||
}
|
||||
#[derive(Serialize,Deserialize, Debug, Clone)]
|
||||
|
||||
pub struct AclDatabaseEntry {
|
||||
pub(crate) mode: AclMode,
|
||||
pub(crate) hostname: Host
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue