Skip to content

feat: port fastbin to casbin - #318

Merged
leeqvip merged 3 commits into
apache:masterfrom
BustDot:feat/fastbin
Sep 16, 2023
Merged

feat: port fastbin to casbin#318
leeqvip merged 3 commits into
apache:masterfrom
BustDot:feat/fastbin

Conversation

@BustDot

@BustDot BustDot commented Sep 7, 2023

Copy link
Copy Markdown
Contributor

Replace: #285

@casbin-bot

Copy link
Copy Markdown

@Nekotoxin please review

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

leeqvip commented Sep 7, 2023

Copy link
Copy Markdown
Contributor

@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

BustDot commented Sep 7, 2023

Copy link
Copy Markdown
Contributor Author

@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

leeqvip commented Sep 9, 2023

Copy link
Copy Markdown
Contributor

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

leeqvip commented Sep 9, 2023

Copy link
Copy Markdown
Contributor

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

hsluoyz commented Sep 9, 2023

Copy link
Copy Markdown
Member

@leeqvip @BustDot the 2nd way FastEnforcer is good

@hsluoyz

hsluoyz commented Sep 15, 2023

Copy link
Copy Markdown
Member

@leeqvip plz review

Comment thread casbin/fast_enforcer.py Outdated
Comment thread casbin/fast_enforcer.py Outdated
@BustDot
BustDot requested a review from leeqvip September 16, 2023 05:39
@leeqvip
leeqvip merged commit 67537d6 into apache: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
Copy Markdown

🎉 This PR is included in version 1.28.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hsluoyz

hsluoyz commented Sep 16, 2023

Copy link
Copy Markdown
Member

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

image

@BustDot
BustDot deleted the feat/fastbin branch September 24, 2023 00:28
Chimou0 pushed a commit to Chimou0/pycasbin that referenced this pull request Jul 17, 2025
* feat: port fastbin

* feat: implement FastEnforcer

* fix: remove redundant init code
Chimou0 pushed a commit to Chimou0/pycasbin that referenced this pull request Jul 17, 2025
# [1.28.0](apache/casbin-pycasbin@v1.27.0...v1.28.0) (2023-09-16)

### Features

* port fastbin to casbin ([apache#318](apache#318)) ([67537d6](apache@67537d6))
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