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

feat: add priority_policy_explicit support #250

Merged
merged 10 commits into from Mar 23, 2021
Merged

feat: add priority_policy_explicit support #250

merged 10 commits into from Mar 23, 2021

Conversation

Zxilly
Copy link
Contributor

@Zxilly Zxilly commented Mar 20, 2021

Fix: #248

Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
#248
Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
@hsluoyz
Copy link
Member

hsluoyz commented Mar 20, 2021

@paul4156 please review.

@paul4156
Copy link

@Zxilly @hsluoyz
Swapped policies in priority_policy_explicit.csv

npm test has one failed test:

image

Copy link

@paul4156 paul4156 left a comment

Choose a reason for hiding this comment

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

I left some minor comments. Otherwise, the change looks good to me.
I am not sure if the broken test after swapping policies in example csv file is relevant or not.

Thank you very much!

src/model/model.ts Outdated Show resolved Hide resolved
src/util/util.ts Outdated Show resolved Hide resolved
src/util/util.ts Outdated Show resolved Hide resolved
@Zxilly
Copy link
Contributor Author

Zxilly commented Mar 21, 2021

@paul4156 I try to swap policies but failed to reproduce. Could you please provide more information?

image

Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
src/model/model.ts Outdated Show resolved Hide resolved
src/model/model.ts Outdated Show resolved Hide resolved
src/model/model.ts Outdated Show resolved Hide resolved
src/util/util.ts Outdated Show resolved Hide resolved
@paul4156
Copy link

@paul4156 I try to swap policies but failed to reproduce. Could you please provide more information?

image

I cannot reliably reproduce the failure either... Please ignore.

@nodece
Copy link
Member

nodece commented Mar 21, 2021

@Zxilly you also should add this feature to remove, update action, and add unit test for this changes.

Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
@Zxilly
Copy link
Contributor Author

Zxilly commented Mar 21, 2021

@nodece remove a policy will not break the priority.
I will later add it to update. My implement will be like

When checked priority, update will not operate policy directly but use removePolicy and addPolicy

But it seems not atomic

Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
@Zxilly Zxilly requested a review from nodece March 21, 2021 08:27
src/model/model.ts Outdated Show resolved Hide resolved
Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
src/model/model.ts Outdated Show resolved Hide resolved
throw error when new rule and old rule didn't have same priority

Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
@hsluoyz hsluoyz merged commit 763c18e into casbin:master Mar 23, 2021
github-actions bot pushed a commit that referenced this pull request Mar 23, 2021
# [5.6.0](v5.5.0...v5.6.0) (2021-03-23)

### Features

* add priority_policy_explicit support ([#250](#250)) ([763c18e](763c18e))
@github-actions
Copy link

🎉 This PR is included in version 5.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

[Bug] priority_policy_explicit does not respect priority
4 participants