From bb13c033bc16661ba1d12192d48e8a298c459d41 Mon Sep 17 00:00:00 2001 From: Hackerchai Date: Mon, 31 Aug 2020 22:42:12 +0800 Subject: [PATCH] Feat: bump version 0.4.1 --- Cargo.toml | 2 +- README.md | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5661be6..9736f4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-casbin-auth" -version = "0.4.0" +version = "0.4.1" authors = ["Eason Chai ","Cheng JIANG "] edition = "2018" license = "Apache-2.0" diff --git a/README.md b/README.md index 87b3f0b..c14b1e8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Add it to `Cargo.toml` ```rust -actix-casbin-auth = "0.4.0" +actix-casbin-auth = "0.4.1" actix-rt = "1.1.1" actix-web = "2.0.0" ``` @@ -107,11 +107,21 @@ mod fake_auth; #[actix_rt::main] async fn main() -> Result<()> { - let m = DefaultModel::from_file("examples/rbac_restful_keymatch2_model.conf").await?; - let a = FileAdapter::new("examples/rbac_restful_keymatch2_policy.csv"); //You can also use diesel-adapter or sqlx-adapter + let m = DefaultModel::from_file("examples/rbac_with_pattern_model.conf") + .await + .unwrap(); + let a = FileAdapter::new("examples/rbac_with_pattern_policy.csv"); //You can also use diesel-adapter or sqlx-adapter let casbin_middleware = CasbinService::new(m, a).await; + casbin_middleware + .write() + .await + .get_role_manager() + .write() + .unwrap() + .matching_fn(Some(key_match2), None); + HttpServer::new(move || { App::new() .wrap(casbin_middleware.clone())