Skip to main content

Peewee Adapter for PyCasbin

Project description

Peewee Adapter for PyCasbin

Build Status Coverage Status Version PyPI - Wheel Pyversions Download License

Peewee Adapter is the Peewee adapter for PyCasbin. With this library, Casbin can load policy from Peewee supported database or save policy to it.

Based on Officially Supported Databases, The current supported databases are:

  • PostgreSQL
  • MySQL
  • SQLite


pip install casbin_peewee_adapter

Simple Example

import casbin_peewee_adapter
import casbin
import peewee
DATABAEE = 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.

if e.enforce(sub, obj, act):
    # permit alice to read data1casbin_peewee_adapter
    # deny the request, show an error

Getting Help


This project is licensed under the Apache 2.0 license.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for casbin-peewee-adapter, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size casbin_peewee_adapter-0.0.2-py3.7.egg (7.5 kB) File type Egg Python version 3.7 Upload date Hashes View
Filename, size casbin_peewee_adapter-0.0.2-py3-none-any.whl (9.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size casbin_peewee_adapter-0.0.2.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page