mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +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]
|
||||
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"]}
|
||||
|
@ -23,5 +23,4 @@ In this example, you can get the the successful result at `http://localhost:8080
|
||||
|
||||
## 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>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user