Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 4, 2022

Conversation

greenhandatsjtu
Copy link
Contributor

@greenhandatsjtu greenhandatsjtu commented May 2, 2022

For now, delete_user() only removes grouping policies:

casbin-rs/src/rbac_api.rs

Lines 259 to 262 in ef5ef67

async fn delete_user(&mut self, name: &str) -> Result<bool> {
self.remove_filtered_grouping_policy(0, vec![name.to_string()])
.await
}

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 ( casbin/node-casbin#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
Copy link
Member

@smrpn @hackerchai @PsiACE @GopherJ please review

@hsluoyz
Copy link
Member

hsluoyz commented May 2, 2022

@PsiACE

@codecov
Copy link

codecov bot commented May 2, 2022

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%) ⬇️

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.

Copy link
Contributor

@PsiACE PsiACE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@greenhandatsjtu
Copy link
Contributor Author

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: casbin-rs/sqlx-adapter#64

@PsiACE
Copy link
Contributor

PsiACE commented May 3, 2022

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.

Copy link
Member

@hackerchai hackerchai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hackerchai hackerchai merged commit 41db260 into casbin:master May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants