-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: HasLink() couldn't get a correct result when RoleManager has MatchingFunc #702
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
Conversation
@RobotHuang plz fix CI: |
@abichinger please review. |
LGTM, although the linter is not happy @hsluoyz Should the RoleManager with MatchingFunc support one-to-many links? For example, what is the expected result of: rm.AddLink("u1", "g\\d+")
rm.HasLink("u1", "g1") // true?
rm.HasLink("u1", "g2") // true? The current result is |
b414616
to
9f377f1
Compare
@abichinger now we don't support this, and we must add role |
15b334c
to
1193861
Compare
@abichinger @hsluoyz now support one-to-many links. plz review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation creates unwanted links.
Example:
_ = rm.Clear()
_ = rm.AddLink("u1", "g\\d+")
testRole(t, rm, "g1", "g2", false)
Output:
role_manager_test.go:301: g1, g2: true
role_manager_test.go:301: g1 < g2: true, supposed to be false
FAIL
@RobotHuang Please have a look at the pycasbin implementation of the RoleManager
.
I think it would be good to keep the implementations close to each other.
@abichinger fine, I will see how |
@abichinger Does |
6075326
to
54e79a8
Compare
@abichinger @hsluoyz plz review. |
…chingFunc Signed-off-by: RobotHuang <1183598761@qq.com> feat: HasLink() with MatchingFunc supports one-to-many links Signed-off-by: RobotHuang <1183598761@qq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
🎉 This PR is included in version 2.23.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
fix: #701