diff --git a/Cargo.toml b/Cargo.toml index f1c0b3b..dbf7ed7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "actix_casbin_auth" path = "src/lib.rs" [dependencies] -casbin = { version = "1.1.3", default-features = false, features = ["incremental", "cached"] } +casbin = { version = "2.0.1", default-features = false, features = ["incremental", "cached"] } tokio = { version = "0.2.22", default-features = false, optional = true } async-std = { version = "1.6.3", default-features = false, optional = true } actix-web = "2.0.0" diff --git a/src/middleware.rs b/src/middleware.rs index d81be93..c6b1cc0 100644 --- a/src/middleware.rs +++ b/src/middleware.rs @@ -119,12 +119,12 @@ where return Ok(req.into_response(HttpResponse::Unauthorized().finish().into_body())) } }; - let subject = &vals.subject; + let subject = vals.subject.clone(); if !vals.subject.is_empty() { - if let Some(domain) = &vals.domain { + if let Some(domain) = vals.domain { let lock = cloned_enforcer.write().await; - match lock.enforce(&[subject, domain, &path, &action]) { + match lock.enforce(vec![subject, domain, path, action]) { Ok(true) => { drop(lock); srv.call(req).await @@ -140,7 +140,7 @@ where } } else { let lock = cloned_enforcer.write().await; - match lock.enforce(&[subject, &path, &action]) { + match lock.enforce(vec![subject, path, action]) { Ok(true) => { drop(lock); srv.call(req).await