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 explicit priority support #190

Merged
merged 2 commits into from
Sep 25, 2021
Merged

Conversation

ffyuanda
Copy link
Member

Match with Casbin PR: #550 and #766

Signed-off-by: ffyuanda 46557895+ffyuanda@users.noreply.github.com

@ffyuanda
Copy link
Member Author

@hsluoyz @techoner plz review, and the failed tests are due to a emergency database maintenance by coveralls.io, see here for further details.

@hsluoyz hsluoyz requested review from Zxilly and leeqvip and removed request for Zxilly September 21, 2021 05:37
@@ -81,14 +83,39 @@ def has_policy(self, sec, ptype, rule):

return rule in self[sec][ptype].policy

def add_policy(self, sec, ptype, rule):
def add_policy(self, sec, ptype, rule) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we don't need to think about type hint right now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah but without type hint sometimes it's not easy to follow and regulate the program, especially for new developers.
Maybe we can add it later in a major release.

Copy link
Contributor

@Zxilly Zxilly Sep 21, 2021

Choose a reason for hiding this comment

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

@ffyuanda You can lead this style to the whole library in another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Zxilly Sure we can do that

@hsluoyz
Copy link
Member

hsluoyz commented Sep 21, 2021

@ffyuanda plz fix:

image

@ffyuanda
Copy link
Member Author

@hsluoyz @techoner plz review, and the failed tests are due to a emergency database maintenance by coveralls.io, see here for further details.

@hsluoyz This is because coveralls.io is working on a maintenance so we cannot use their API yet.

Signed-off-by: ffyuanda <46557895+ffyuanda@users.noreply.github.com>
@ffyuanda
Copy link
Member Author

@techoner plz review

casbin/core_enforcer.py Outdated Show resolved Hide resolved
@ffyuanda
Copy link
Member Author

@techoner updated load_policy()

except:

if self.auto_build_role_links and need_to_rebuild:
self.build_role_links()
Copy link
Member

Choose a reason for hiding this comment

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

@ffyuanda Here to throw the caught exception again.

Copy link
Member Author

Choose a reason for hiding this comment

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

@techoner Just update, I catch the error and throw it after everything else.

Signed-off-by: ffyuanda <shaoxuan.yuan02@gmail.com>
@leeqvip leeqvip merged commit 9445086 into casbin:master Sep 25, 2021
github-actions bot pushed a commit that referenced this pull request Sep 25, 2021
# [1.9.0](v1.8.1...v1.9.0) (2021-09-25)

### Features

* add explicit priority support ([#190](#190)) ([9445086](9445086))
@github-actions
Copy link

🎉 This PR is included in version 1.9.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.

4 participants