Skip to content

Commit

Permalink
Merge pull request #12 from hackerchai/master
Browse files Browse the repository at this point in the history
Feat: bump version 0.3.2
  • Loading branch information
hackerchai authored Aug 25, 2020
2 parents 06a01d1 + 2bddf06 commit e83e4ed
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-casbin"
version = "0.3.1"
version = "0.3.2"
authors = ["Eason Chai <[email protected]>","Cheng JIANG <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Add it to `Cargo.toml`

```rust
actix-casbin = "0.3.1"
actix-casbin = "0.3.2"
actix-rt = "1.1.1"
```

Expand Down
36 changes: 36 additions & 0 deletions src/casbin_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ pub enum CasbinCmd {
Enforce(Vec<String>),
AddPolicy(Vec<String>),
AddPolicies(Vec<Vec<String>>),
AddNamedPolicy(String, Vec<String>),
AddNamedPolicies(String, Vec<Vec<String>>),
AddGroupingPolicy(Vec<String>),
AddGroupingPolicies(Vec<Vec<String>>),
AddNamedGroupingPolicy(String, Vec<String>),
AddNamedGroupingPolicies(String, Vec<Vec<String>>),
RemovePolicy(Vec<String>),
RemovePolicies(Vec<Vec<String>>),
RemoveFilteredPolicy(usize, Vec<String>),
Expand All @@ -29,6 +35,12 @@ pub enum CasbinResult {
Enforce(bool),
AddPolicy(bool),
AddPolicies(bool),
AddNamedPolicy(bool),
AddNamedPolicies(bool),
AddGroupingPolicy(bool),
AddGroupingPolicies(bool),
AddNamedGroupingPolicy(bool),
AddNamedGroupingPolicies(bool),
RemovePolicy(bool),
RemovePolicies(bool),
RemoveFilteredPolicy(bool),
Expand Down Expand Up @@ -104,6 +116,30 @@ impl<T: IEnforcer + 'static> Handler<CasbinCmd> for CasbinActor<T> {
.add_policies(policy)
.await
.map(CasbinResult::AddPolicies),
CasbinCmd::AddNamedPolicy(ptype, policy) => lock
.add_named_policy(&ptype, policy)
.await
.map(CasbinResult::AddNamedPolicy),
CasbinCmd::AddNamedPolicies(ptype, policy) => lock
.add_named_policies(&ptype, policy)
.await
.map(CasbinResult::AddNamedPolicies),
CasbinCmd::AddGroupingPolicy(policy) => lock
.add_grouping_policy(policy)
.await
.map(CasbinResult::AddGroupingPolicy),
CasbinCmd::AddGroupingPolicies(policy) => lock
.add_grouping_policies(policy)
.await
.map(CasbinResult::AddGroupingPolicies),
CasbinCmd::AddNamedGroupingPolicy(ptype, policy) => lock
.add_named_grouping_policy(&ptype, policy)
.await
.map(CasbinResult::AddNamedGroupingPolicy),
CasbinCmd::AddNamedGroupingPolicies(ptype, policy) => lock
.add_named_grouping_policies(&ptype, policy)
.await
.map(CasbinResult::AddNamedGroupingPolicies),
CasbinCmd::RemovePolicy(policy) => lock
.remove_policy(policy)
.await
Expand Down

0 comments on commit e83e4ed

Please sign in to comment.