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

[Question] Why is the permission check inconsistent #1394

Closed
dhonor-dyj opened this issue May 15, 2024 · 6 comments
Closed

[Question] Why is the permission check inconsistent #1394

dhonor-dyj opened this issue May 15, 2024 · 6 comments

Comments

@dhonor-dyj
Copy link

dhonor-dyj commented May 15, 2024

After the policy is added, the data is checked. It is found that the check is true at the beginning, false later, and true again a few seconds later
image

@casbin-bot
Copy link
Member

@tangyang9464 @JalinWang

@MuZhou233
Copy link
Contributor

@dhonor-dyj Please provide a minimum reproduction.

@dhonor-dyj
Copy link
Author

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.obj == p.obj && g(r.sub, p.sub) && r.act == p.act

This is the model definition

@dhonor-dyj
Copy link
Author

The problem is that after you add policies p and g, the user will be checked several times. Not always, but after a few seconds, the user will be checked. The check method is BatchEnforcce().

@MuZhou233
Copy link
Contributor

The problem is that after you add policies p and g, the user will be checked several times. Not always, but after a few seconds, the user will be checked. The check method is BatchEnforcce().

I can't reproduce this problem based on your description. Please provide model(we already have), policy, and code that can reproduce this problem.

@dhonor-dyj
Copy link
Author

resolved, The reason is that an error occurs when watcher is used for synchronization. Each time the database is changed, the instance is not excluded during synchronization, and the default loadPolicy() function is used to reload the policy during synchronization. During the loading process, a new check fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants