mirror of
https://github.com/actix/examples
synced 2024-11-30 17:14:35 +01:00
Update dependencies for casbin example. (#300)
* Update dependencies & Clean description. * Add .env for logger. * Updating code due to code review.
This commit is contained in:
parent
3b7d9d8b7a
commit
9155edfe8d
@ -7,6 +7,6 @@ workspace = ".."
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "2.0"
|
actix-web = "2.0"
|
||||||
actix-rt = "1.0"
|
actix-rt = "1.1.0"
|
||||||
casbin = "0.4"
|
casbin = "0.6.0"
|
||||||
loge = {version = "0.4", default-features = false, features = ["colored", "chrono"]}
|
loge = {version = "0.4", default-features = false, features = ["colored", "chrono"]}
|
||||||
|
@ -23,5 +23,4 @@ In this example, you can get the the successful result at `http://localhost:8080
|
|||||||
|
|
||||||
## Others
|
## Others
|
||||||
|
|
||||||
- Original location of this demo: <https://github.com/PsiACE/actix-casbin-example>
|
|
||||||
- For more related examples of [Casbin-RS](https://github.com/casbin/casbin-rs): <https://github.com/casbin-rs/examples>
|
- For more related examples of [Casbin-RS](https://github.com/casbin/casbin-rs): <https://github.com/casbin-rs/examples>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use casbin::{DefaultModel, Enforcer, FileAdapter, RbacApi};
|
use casbin::{CoreApi, DefaultModel, Enforcer, FileAdapter, RbacApi};
|
||||||
use std::boxed::Box;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
|
|
||||||
@ -37,9 +36,7 @@ async fn main() -> io::Result<()> {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let adapter = FileAdapter::new("rbac/rbac_policy.csv");
|
let adapter = FileAdapter::new("rbac/rbac_policy.csv");
|
||||||
|
|
||||||
let e = Enforcer::new(Box::new(model), Box::new(adapter))
|
let e = Enforcer::new(model, adapter).await.unwrap();
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
let e = web::Data::new(RwLock::new(e)); // wrap enforcer into actix-state
|
let e = web::Data::new(RwLock::new(e)); // wrap enforcer into actix-state
|
||||||
|
|
||||||
//move is necessary to give closure below ownership of counter
|
//move is necessary to give closure below ownership of counter
|
||||||
|
Loading…
Reference in New Issue
Block a user