casbin / casbin-rs

An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
https://casbin.org
Apache License 2.0
828 stars 67 forks source link

fix: delete_user() should remove both grouping policies and policies #292

Closed greenhandatsjtu closed 2 years ago

greenhandatsjtu commented 2 years ago

For now, delete_user() only removes grouping policies: https://github.com/casbin/casbin-rs/blob/ef5ef67a9257f5864a568ab4eeaae618ab510603/src/rbac_api.rs#L259-L262 But other versions (Golang, Node, Python, etc.) remove both grouping policies and policies, take Golang version for example: https://github.com/casbin/casbin/blob/cb944fd5ef0a0029b6e74b8ca658f7dcb72e69f9/rbac_api.go#L95-L104

Previous discussion is here ( https://github.com/casbin/node-casbin/issues/118 ) , and participants including @hsluoyz agreed that delete_user() should also delete policies, not only grouping policies.

Related PRs:

PS: I'm a GSoC 2022 candidate and submitted my proposal for casbin-rs. I've made several PRs to Casbin community, this is my first PR to casbin-rs, glad to meet all of you!

casbin-bot commented 2 years ago

@smrpn @hackerchai @PsiACE @GopherJ please review

hsluoyz commented 2 years ago

@PsiACE

codecov[bot] commented 2 years ago

Codecov Report

Merging #292 (36aaafd) into master (ef5ef67) will decrease coverage by 0.00%. The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master     #292      +/-   ##
==========================================
- Coverage   81.03%   81.02%   -0.01%     
==========================================
  Files          23       23              
  Lines        3337     3342       +5     
==========================================
+ Hits         2704     2708       +4     
- Misses        633      634       +1     
Impacted Files Coverage Δ
src/rbac_api.rs 89.37% <77.77%> (-0.09%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ef5ef67...36aaafd. Read the comment docs.

greenhandatsjtu commented 2 years ago

Hi @PsiACE , thanks for reviewing! I'm a GSoC 2022 candidate applying for Rust project. I've contributed to several Casbin repos like casdoor, casnode, and casbin-website, and now I want to make some contributions to casbin-rs related repos, could you please give me some advices on what I should work on next? Thank you! Currently, I'm trying to solve this issue: https://github.com/casbin-rs/sqlx-adapter/issues/64

PsiACE commented 2 years ago

could you please give me some advices on what I should work on next?

It is good to see that you have chosen Casbin Rust in GSoC 2022. At this stage, we encourage students to get involved in the maintenance of Casbin Rust and its surrounding ecology.

If you have any questions, you can also contact me by email.