pycasbin的peewee适配器

casbin-peewee-adapter的Python项目详细描述


pycasbin的peewee适配器

Build StatusCoverage StatusVersionPyPI - WheelPyversionsDownloadLicense

peewee适配器是PyCasbinPeewee适配器。使用此库,casbin可以从peewee支持的数据库加载策略或将策略保存到其中。

基于Officially Supported Databases,当前支持的数据库是:

  • PostgreSQL
  • mysql
  • sqlite

安装

pip install casbin_peewee_adapter

简单示例

importcasbin_peewee_adapterimportcasbinimportpeeweeDATABAEE=peewee.SqliteDatabase('db.sqlite3')adapter=casbin_peewee_adapter.Adapter(database=DATABAEE)e=casbin.Enforcer('path/to/model.conf',adapter,True)sub="alice"# the user that wants to access a resource.obj="data1"# the resource that is going to be accessed.act="read"# the operation that the user performs on the resource.ife.enforce(sub,obj,act):# permit alice to read data1casbin_peewee_adapterpasselse:# deny the request, show an errorpass

获得帮助

许可证

这个项目是根据Apache 2.0 license授权的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java线程;创建一个单独的线程来定期执行某些操作   用java将SonarQube升级到5.2失败。util。同时发生的CancellationException:空   在线程对象上调用start时,线程上设置的java优先级无效   java如何在不使用reduce()或last()折叠的情况下获取通量的最后一项   java如何从ArrayList中获取元素?   应用了逻辑的JavaTwitterAPI   在这种情况下,怎样才能不让自己重复?安卓的java   JavaAndroid:线程可运行和处理程序。在run方法中发布问题(Handler.postXX在预期情况下不会按时运行)   java log4j grok与管道故障   使用循环返回命令选项时出现问题/仅运行一个命令(JAVA)   java双重比较问题   使用vertx的JWT公钥/私钥身份验证中的java握手   用Java将WMA和AAC音频转换为MP3   解析字符串java get index   与具有不同数据类型的密钥同名的java JSON