feat: added ACL commands

This commit is contained in:
NinekoTheCat 2023-12-24 17:46:24 +01:00
parent 13e497936f
commit 90232b894d
No known key found for this signature in database
GPG key ID: 700DB3F678A4AB66
3 changed files with 71 additions and 3 deletions

View file

@ -1,5 +1,6 @@
use std::collections::HashSet;
use clap::ValueEnum;
use serde::{Serialize, Deserialize};
use url::Host;
@ -17,11 +18,20 @@ pub trait Data: Send + Sync {
fn get_all_acls(&self) -> HashSet<AclDatabaseEntry>;
}
#[derive(Serialize,Deserialize, Debug, Clone, Copy, Hash, Eq, PartialEq)]
#[derive(Serialize,Deserialize, Debug, Clone, Copy, Hash, Eq, PartialEq, ValueEnum)]
pub enum AclMode{
Block,
Allow
}
impl AclMode {
pub fn to_emoji(&self)-> char {
match self {
AclMode::Block => '❎',
AclMode::Allow => '✅',
}
}
}
#[derive(Serialize,Deserialize, Debug, Clone, Hash, Eq,PartialEq)]
pub struct AclDatabaseEntry {

View file

@ -1,6 +1,6 @@
use std::{sync::Arc, collections::HashSet};
use std::sync::Arc;
use ruma::ServerName;
use tracing::{warn, debug, error};