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: port fastbin to casbin #318

Merged
merged 3 commits into from
Sep 16, 2023
Merged

feat: port fastbin to casbin #318

merged 3 commits into from
Sep 16, 2023

Conversation

BustDot
Copy link
Contributor

@BustDot BustDot commented Sep 7, 2023

Replace: #285

@casbin-bot
Copy link
Member

@Nekotoxin please review

@casbin-bot casbin-bot requested a review from Nekotoxin September 7, 2023 07:09
@leeqvip
Copy link
Member

leeqvip commented Sep 7, 2023

@BustDot @hsluoyz I think this is a minority scene, and its model and policy must comply with specific rules. It should not be brought into the main repository, which would be very bloated. If it must be done, I think there can be another extension library based on pycasbin.

@BustDot
Copy link
Contributor Author

BustDot commented Sep 7, 2023

@BustDot @hsluoyz I think this is a minority scene, and its model and policy must comply with specific rules. It should not be brought into the main repository, which would be very bloated. If it must be done, I think there can be another extension library based on pycasbin.

We can put a link to fastbin in readme. Users who are sensitive to performance can refer it to achieve their own model.

@leeqvip
Copy link
Member

leeqvip commented Sep 9, 2023

Now I have two ideas:

  1. Create another repository
  2. Still in pycasbin, the principle of minimal intrusion is adopted, so create a new FastEnforcer, like this:
class FastEnforcer(Enforcer):
    def new_fast_model():
        m = new FastModel
        # ...
    def enforce(self, *rvals):
        if isinstance(self.model, FastModel ):
            # ...

@leeqvip
Copy link
Member

leeqvip commented Sep 9, 2023

Now I have two ideas:

  1. Create another repository
  2. Still in pycasbin, the principle of minimal intrusion is adopted, so create a new FastEnforcer, like this:
class FastEnforcer(Enforcer):
    def new_fast_model():
        m = new FastModel
        # ...
    def enforce(self, *rvals):
        if isinstance(self.model, FastModel ):
            # ...

@BustDot Let’s implement it in the second way for the time being.

@hsluoyz
Copy link
Member

hsluoyz commented Sep 9, 2023

@leeqvip @BustDot the 2nd way FastEnforcer is good

@hsluoyz
Copy link
Member

hsluoyz commented Sep 15, 2023

@leeqvip plz review

casbin/fast_enforcer.py Outdated Show resolved Hide resolved
casbin/fast_enforcer.py Outdated Show resolved Hide resolved
@BustDot BustDot requested a review from leeqvip September 16, 2023 05:39
@leeqvip leeqvip merged commit 67537d6 into casbin:master Sep 16, 2023
github-actions bot pushed a commit that referenced this pull request Sep 16, 2023
# [1.28.0](v1.27.0...v1.28.0) (2023-09-16)

### Features

* port fastbin to casbin ([#318](#318)) ([67537d6](67537d6))
@github-actions
Copy link

🎉 This PR is included in version 1.28.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hsluoyz
Copy link
Member

hsluoyz commented Sep 16, 2023

@BustDot add this new feature to the docs page after: https://casbin.org/docs/superadmin

image

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