Skip to content

Commit 397baa5

Browse files
authored
Merge pull request #64 from hocineait7/main
Reopen #63 feat: add -u option and refactoring
2 parents ce34338 + 5aa4b5b commit 397baa5

File tree

17 files changed

+1690
-730
lines changed

17 files changed

+1690
-730
lines changed

rar-common/src/api.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ use serde_json::Value;
99
use strum::EnumIs;
1010

1111
#[cfg(feature = "finder")]
12-
use crate::database::finder::{Cred, ExecSettings, FilterMatcher, TaskMatch, UserMin};
12+
use crate::database::finder::{ActorMatchMin, Cred, ExecSettings, TaskMatch};
13+
use crate::database::FilterMatcher;
1314

14-
use crate::database::structs::{SActor, SConfig, SRole, STask};
15+
use crate::database::{
16+
actor::SActor,
17+
structs::{SConfig, SRole, STask},
18+
};
1519
use once_cell::sync::Lazy;
1620
static API: Lazy<Mutex<PluginManager>> = Lazy::new(|| Mutex::new(PluginManager::new()));
1721

@@ -52,7 +56,7 @@ pub type TaskMatcher = fn(
5256
matcher: &mut TaskMatch,
5357
) -> PluginResultAction;
5458
#[cfg(feature = "finder")]
55-
pub type UserMatcher = fn(role: &SRole, user: &Cred, user_struct: &Value) -> UserMin;
59+
pub type UserMatcher = fn(role: &SRole, user: &Cred, user_struct: &Value) -> ActorMatchMin;
5660

5761
pub type RoleInformation = fn(role: &SRole) -> Option<String>;
5862
pub type ActorInformation = fn(actor: &SActor) -> Option<String>;
@@ -200,15 +204,15 @@ impl PluginManager {
200204
}
201205

202206
#[cfg(feature = "finder")]
203-
pub fn notify_user_matcher(role: &SRole, user: &Cred, user_struct: &Value) -> UserMin {
207+
pub fn notify_user_matcher(role: &SRole, user: &Cred, user_struct: &Value) -> ActorMatchMin {
204208
let api = API.lock().unwrap();
205209
for plugin in api.user_matcher_plugins.iter() {
206210
let res = plugin(role, user, user_struct);
207211
if !res.is_no_match() {
208212
return res;
209213
}
210214
}
211-
UserMin::NoMatch
215+
ActorMatchMin::NoMatch
212216
}
213217

214218
#[cfg(feature = "finder")]

0 commit comments

Comments
 (0)