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: fix bug in add policy for priority effectors #313

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

aditya-nambiar
Copy link
Contributor

@aditya-nambiar aditya-nambiar commented Aug 10, 2023

Fix: #310

Description:

Fixes a bug in assigning an index to a new policy was added when using the priority effector.

The bug is that when we loop from range(i, 0, -1), i stops at 1 ( since range is exclusive for the end parameter ), and hence we cant assign a policy to index 0 in this logic ( in case the newly added policy indeed has the lowest priority )

I swapped it for a simpler logic that bubbles up the inserted policy to the correct index.

Related Issue:
#310

Tests:

Ran - python3 -m unittest discover

..['alice']
..............Request: bob, data1, read ---> False
Request: bob, data1, write ---> False
Request: bob, data2, read ---> False
.............................................
----------------------------------------------------------------------
Ran 462 tests in 0.807s

OK

@casbin-bot
Copy link
Member

@Nekotoxin please review

@CLAassistant
Copy link

CLAassistant commented Aug 10, 2023

CLA assistant check
All committers have signed the CLA.

@aditya-nambiar aditya-nambiar changed the title priority effector: Fix bug in add policy for priority effectors fix: Fix bug in add policy for priority effectors Aug 10, 2023
@aditya-nambiar aditya-nambiar changed the title fix: Fix bug in add policy for priority effectors fix: fix bug in add policy for priority effectors Aug 10, 2023
@hsluoyz
Copy link
Member

hsluoyz commented Aug 10, 2023

@BustDot plz review

@hsluoyz hsluoyz merged commit 8d30537 into casbin:master Aug 10, 2023
12 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 10, 2023
## [1.23.1](v1.23.0...v1.23.1) (2023-08-10)

### Bug Fixes

* fix bug in add policy for priority effectors ([#313](#313)) ([8d30537](8d30537))
@github-actions
Copy link

🎉 This PR is included in version 1.23.1 🎉

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 in priority effectors
4 participants