[−][src]Trait casbin::CoreApi
Required methods
#[must_use]fn new<'async_trait, M: TryIntoModel, A: TryIntoAdapter>(
m: M,
a: A
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
M: 'async_trait,
A: 'async_trait,
Self: 'async_trait,
m: M,
a: A
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
M: 'async_trait,
A: 'async_trait,
Self: 'async_trait,
fn add_function(&mut self, fname: &str, f: fn(_: String, _: String) -> bool)
fn get_model(&self) -> &dyn Model
fn get_mut_model(&mut self) -> &mut dyn Model
fn get_adapter(&self) -> &dyn Adapter
fn get_mut_adapter(&mut self) -> &mut dyn Adapter
fn get_role_manager(&self) -> Arc<RwLock<dyn RoleManager>>
fn set_role_manager(&mut self, rm: Arc<RwLock<dyn RoleManager>>) -> Result<()>
fn add_matching_fn(&mut self, f: fn(_: String, _: String) -> bool) -> Result<()>
#[must_use]fn set_model<'life0, 'async_trait, M: TryIntoModel>(
&'life0 mut self,
m: M
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
M: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self,
m: M
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
M: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
#[must_use]fn set_adapter<'life0, 'async_trait, A: TryIntoAdapter>(
&'life0 mut self,
a: A
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
A: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self,
a: A
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
A: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn set_effector(&mut self, e: Box<dyn Effector>)
#[must_use]fn enforce<'life0, 'life1, 'async_trait, S: AsRef<str> + Send + Sync>(
&'life0 self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
#[must_use]fn enforce_mut<'life0, 'life1, 'async_trait, S: AsRef<str> + Send + Sync>(
&'life0 mut self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 mut self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn build_role_links(&mut self) -> Result<()>
fn build_incremental_role_links(&mut self, d: EventData) -> Result<()>
#[must_use]fn load_policy<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
#[must_use]fn load_filtered_policy<'life0, 'async_trait>(
&'life0 mut self,
f: Filter
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self,
f: Filter
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn is_filtered(&self) -> bool
#[must_use]fn save_policy<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn clear_policy(&mut self)
fn enable_auto_save(&mut self, auto_save: bool)
fn enable_enforce(&mut self, enabled: bool)
fn enable_auto_build_role_links(&mut self, auto_build_role_links: bool)
fn has_auto_save_enabled(&self) -> bool
Implementors
impl CoreApi for Enforcer
[src]
fn new<'async_trait, M: TryIntoModel, A: TryIntoAdapter>(
m: M,
a: A
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
M: 'async_trait,
A: 'async_trait,
Self: 'async_trait,
[src]
m: M,
a: A
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
M: 'async_trait,
A: 'async_trait,
Self: 'async_trait,
fn add_function(&mut self, fname: &str, f: fn(_: String, _: String) -> bool)
[src]
fn get_model(&self) -> &dyn Model
[src]
fn get_mut_model(&mut self) -> &mut dyn Model
[src]
fn get_adapter(&self) -> &dyn Adapter
[src]
fn get_mut_adapter(&mut self) -> &mut dyn Adapter
[src]
fn get_role_manager(&self) -> Arc<RwLock<dyn RoleManager>>
[src]
fn set_role_manager(&mut self, rm: Arc<RwLock<dyn RoleManager>>) -> Result<()>
[src]
fn add_matching_fn(&mut self, f: fn(_: String, _: String) -> bool) -> Result<()>
[src]
fn set_model<'life0, 'async_trait, M: TryIntoModel>(
&'life0 mut self,
m: M
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
M: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
m: M
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
M: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn set_adapter<'life0, 'async_trait, A: TryIntoAdapter>(
&'life0 mut self,
a: A
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
A: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
a: A
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
A: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn set_effector(&mut self, e: Box<dyn Effector>)
[src]
fn enforce<'life0, 'life1, 'async_trait, S: AsRef<str> + Send + Sync>(
&'life0 self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Enforce decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (sub, obj, act).
Examples
use casbin::prelude::*; #[cfg(feature = "runtime-async-std")] #[async_std::main] async fn main() -> Result<()> { let mut e = Enforcer::new("examples/basic_model.conf", "examples/basic_policy.csv").await?; assert_eq!(true, e.enforce(&["alice", "data1", "read"]).await?); Ok(()) } #[cfg(feature = "runtime-tokio")] #[tokio::main] async fn main() -> Result<()> { let mut e = Enforcer::new("examples/basic_model.conf", "examples/basic_policy.csv").await?; assert_eq!(true, e.enforce(&["alice", "data1", "read"]).await?); Ok(()) } #[cfg(all(not(feature = "runtime-async-std"), not(feature = "runtime-tokio")))] fn main() {}
fn enforce_mut<'life0, 'life1, 'async_trait, S: AsRef<str> + Send + Sync>(
&'life0 mut self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
rvals: &'life1 [S]
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn build_role_links(&mut self) -> Result<()>
[src]
fn build_incremental_role_links(&mut self, d: EventData) -> Result<()>
[src]
fn load_policy<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn load_filtered_policy<'life0, 'async_trait>(
&'life0 mut self,
f: Filter
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
f: Filter
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn is_filtered(&self) -> bool
[src]
fn save_policy<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,