From 9155edfe8d73d49c3a4a94a0d03d431d98007a1a Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Mon, 20 Apr 2020 06:52:00 +0800 Subject: [PATCH] Update dependencies for casbin example. (#300) * Update dependencies & Clean description. * Add .env for logger. * Updating code due to code review. --- casbin/Cargo.toml | 6 +++--- casbin/README.md | 1 - casbin/src/main.rs | 7 ++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/casbin/Cargo.toml b/casbin/Cargo.toml index 0c4ee816..d35661fd 100644 --- a/casbin/Cargo.toml +++ b/casbin/Cargo.toml @@ -7,6 +7,6 @@ workspace = ".." [dependencies] actix-web = "2.0" -actix-rt = "1.0" -casbin = "0.4" -loge = { version = "0.4", default-features = false, features = ["colored", "chrono"] } +actix-rt = "1.1.0" +casbin = "0.6.0" +loge = {version = "0.4", default-features = false, features = ["colored", "chrono"]} diff --git a/casbin/README.md b/casbin/README.md index 752ef2a9..198042ac 100644 --- a/casbin/README.md +++ b/casbin/README.md @@ -23,5 +23,4 @@ In this example, you can get the the successful result at `http://localhost:8080 ## Others -- Original location of this demo: - For more related examples of [Casbin-RS](https://github.com/casbin/casbin-rs): diff --git a/casbin/src/main.rs b/casbin/src/main.rs index 3ae6bfb9..2394ffa6 100644 --- a/casbin/src/main.rs +++ b/casbin/src/main.rs @@ -1,5 +1,4 @@ -use casbin::{DefaultModel, Enforcer, FileAdapter, RbacApi}; -use std::boxed::Box; +use casbin::{CoreApi, DefaultModel, Enforcer, FileAdapter, RbacApi}; use std::io; use std::sync::RwLock; @@ -37,9 +36,7 @@ async fn main() -> io::Result<()> { .unwrap(); let adapter = FileAdapter::new("rbac/rbac_policy.csv"); - let e = Enforcer::new(Box::new(model), Box::new(adapter)) - .await - .unwrap(); + let e = Enforcer::new(model, adapter).await.unwrap(); let e = web::Data::new(RwLock::new(e)); // wrap enforcer into actix-state //move is necessary to give closure below ownership of counter