Skip to main content

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

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.

Metadata

Release files for casbin-peewee-adapter 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for casbin-peewee-adapter 0.0.2
File Size Uploaded Provenance Actions
casbin_peewee_adapter-0.0.2.tar.gz 3.3 kB Without provenance Details for casbin_peewee_adapter-0.0.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for casbin-peewee-adapter 0.0.2
File Interpreter ABI Platform Actions
casbin_peewee_adapter-0.0.2-py3.7.egg Legacy Egg format - - Details for casbin_peewee_adapter-0.0.2-py3.7.egg
casbin_peewee_adapter-0.0.2-py3-none-any.whl Python 3 none any Details for casbin_peewee_adapter-0.0.2-py3-none-any.whl

Total release size: 19.8 kB

Release files / casbin_peewee_adapter-0.0.2.tar.gz

Download URL casbin_peewee_adapter-0.0.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0504e78fe1ed3fd060b990b747d68e3ae54907ed5d0bbf2717cf80b2fd89be39
BLAKE2b-256 checksum
How to use checksums
e2f1b23573fb0c4fdc7afc53e19da382f5e4f8fd0bd6fc630a90881da5fcc3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0

Release files / casbin_peewee_adapter-0.0.2-py3.7.egg

Download URL casbin_peewee_adapter-0.0.2-py3.7.egg
Size 7.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
6f9c43c25883cd3e1d006c07e3b9ef20b1c0a1e79b22a019381842c16be87091
BLAKE2b-256 checksum
How to use checksums
72728b84a34e78c9f3ef3ac5f7472c4751cdb2f2d54382adb5e4d7ee27471446
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0

Release files / casbin_peewee_adapter-0.0.2-py3-none-any.whl

Download URL casbin_peewee_adapter-0.0.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5c51b718a0977e6d1502832c8f82b2698382c0a5272837d5c2ffb6a0d9a22e6
BLAKE2b-256 checksum
How to use checksums
90de3fa940565b6ea52aa28c1d36c9e2108ff867a7e2402bc65e18051756986b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0

Security for casbin-peewee-adapter 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page