Peewee Adapter for PyCasbin
Project description
Peewee Adapter for PyCasbin
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
Installation
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
pass
else:
# deny the request, show an error
pass
Getting Help
License
This project is licensed under the Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for casbin_peewee_adapter-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0504e78fe1ed3fd060b990b747d68e3ae54907ed5d0bbf2717cf80b2fd89be39 |
|
MD5 | 5aa51afcf3bf3be0b72d81399ab76b01 |
|
BLAKE2b-256 | e2f1b23573fb0c4fdc7afc53e19da382f5e4f8fd0bd6fc630a90881da5fcc3fa |
Close
Hashes for casbin_peewee_adapter-0.0.2-py3.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f9c43c25883cd3e1d006c07e3b9ef20b1c0a1e79b22a019381842c16be87091 |
|
MD5 | 937bd320a211f6ac1faa54ee3746dfc2 |
|
BLAKE2b-256 | 72728b84a34e78c9f3ef3ac5f7472c4751cdb2f2d54382adb5e4d7ee27471446 |
Close
Hashes for casbin_peewee_adapter-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5c51b718a0977e6d1502832c8f82b2698382c0a5272837d5c2ffb6a0d9a22e6 |
|
MD5 | 27339d7b13be92293432923fb93b5834 |
|
BLAKE2b-256 | 90de3fa940565b6ea52aa28c1d36c9e2108ff867a7e2402bc65e18051756986b |