Giter Site home page Giter Site logo

add_policies inoperative about pycasbin HOT 11 CLOSED

moreKing avatar moreKing commented on May 27, 2024
add_policies inoperative

from pycasbin.

Comments (11)

casbin-bot avatar casbin-bot commented on May 27, 2024

@techoner @Nekotoxin

from pycasbin.

moreKing avatar moreKing commented on May 27, 2024

Screenshot error, re-attach the picture
image

from pycasbin.

BustDot avatar BustDot commented on May 27, 2024

It seems that you are using asynccasbin, which is not official maintained. In pycasbin, I tried with the following code and the behavior is correct. Since I don't know how you write your model, I just used this model.
image

Also, we are considering add official support for async in the following weeks. You can follow our latest updates.

from pycasbin.

hsluoyz avatar hsluoyz commented on May 27, 2024

@moreKing if you are using this 3rd-party async lib: https://github.com/chapagainmanoj/asynccasbin , please note that lib is not maintained by Casbin. You should create an issue at that repo

from pycasbin.

wu-clan avatar wu-clan commented on May 27, 2024

asynccasbin is indeed no longer maintained and has closed all interaction channels

The official asynchronous repository has been created for a year, but nothing has happened: https://github.com/casbin/async-pycasbin

Very much looking forward to any development of it as there are still quite a few users who like casbin

Why use asynchrony? Asynchronous is gaining popularity due to FastAPI, and you can imagine how bad it would be to integrate a synchronous license into an asynchronous project, even though there is already asynccasbin, which, as mentioned above, is no longer maintained, and even though there are already a number of asynchronous storage tools, they are all based on asynccasbin, which will always have limitations.

In my projects fastapi-practices, casbin has always been preferred for permissions, but due to some issues with the asynchronous storage, I had to temporarily replace it with a custom permission,But their implementation has remained in the code

As you can tell by asynccasbin, the asynchronous version is perfectly viable, hopefully there will be some official action here, hard work guys!

I'm willing to actively do the testing

from pycasbin.

leeqvip avatar leeqvip commented on May 27, 2024

asynccasbin is indeed no longer maintained and has closed all interaction channels

The official asynchronous repository has been created for a year, but nothing has happened: https://github.com/casbin/async-pycasbin

Very much looking forward to any development of it as there are still quite a few users who like casbin

Why use asynchrony? Asynchronous is gaining popularity due to FastAPI, and you can imagine how bad it would be to integrate a synchronous license into an asynchronous project, even though there is already asynccasbin, which, as mentioned above, is no longer maintained, and even though there are already a number of asynchronous storage tools, they are all based on asynccasbin, which will always have limitations.

In my projects fastapi-practices, casbin has always been preferred for permissions, but due to some issues with the asynchronous storage, I had to temporarily replace it with a custom permission,But their implementation has remained in the code

As you can tell by asynccasbin, the asynchronous version is perfectly viable, hopefully there will be some official action here, hard work guys!

I'm willing to actively do the testing

We're working on it this summer.

from pycasbin.

moreKing avatar moreKing commented on May 27, 2024

thank every one of you, I use the library is according to the official website document to install casbin, the use of orm is tortoise-orm[asyncpg], the adapter is written by me, my current practice is to batch delete all eligible, and then batch add

from pycasbin.

leeqvip avatar leeqvip commented on May 27, 2024

thank every one of you, I use the library is according to the official website document to install casbin, the use of orm is tortoise-orm[asyncpg], the adapter is written by me, my current practice is to batch delete all eligible, and then batch add

@moreKing If you use the official casbin, it shouldn't have this problem, can you show your model ?

from pycasbin.

moreKing avatar moreKing commented on May 27, 2024

I'm not sure what I did wrong, so I took a screenshot of all the relevant code. I only implemented load_policy and save_policy two methods for the adapter, and the contents of other methods were pass,which I did not want to save automatically. I stored the model in a variable, and did not use file saving to minimize external dependencies
image
image
image

from pycasbin.

leeqvip avatar leeqvip commented on May 27, 2024

@moreKing Please try the existing policies in the database?
add_policies execution will terminate if it encounters an existing policy.

from pycasbin.

hsluoyz avatar hsluoyz commented on May 27, 2024

Closed as resolved

from pycasbin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.