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

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


Download files

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

Source Distribution

casbin_peewee_adapter-0.0.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distributions

casbin_peewee_adapter-0.0.2-py3.7.egg (7.5 kB view details)

Uploaded Source

casbin_peewee_adapter-0.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file casbin_peewee_adapter-0.0.2.tar.gz.

File metadata

  • Download URL: casbin_peewee_adapter-0.0.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for casbin_peewee_adapter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0504e78fe1ed3fd060b990b747d68e3ae54907ed5d0bbf2717cf80b2fd89be39
MD5 5aa51afcf3bf3be0b72d81399ab76b01
BLAKE2b-256 e2f1b23573fb0c4fdc7afc53e19da382f5e4f8fd0bd6fc630a90881da5fcc3fa

See more details on using hashes here.

File details

Details for the file casbin_peewee_adapter-0.0.2-py3.7.egg.

File metadata

  • Download URL: casbin_peewee_adapter-0.0.2-py3.7.egg
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for casbin_peewee_adapter-0.0.2-py3.7.egg
Algorithm Hash digest
SHA256 6f9c43c25883cd3e1d006c07e3b9ef20b1c0a1e79b22a019381842c16be87091
MD5 937bd320a211f6ac1faa54ee3746dfc2
BLAKE2b-256 72728b84a34e78c9f3ef3ac5f7472c4751cdb2f2d54382adb5e4d7ee27471446

See more details on using hashes here.

File details

Details for the file casbin_peewee_adapter-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: casbin_peewee_adapter-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for casbin_peewee_adapter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c51b718a0977e6d1502832c8f82b2698382c0a5272837d5c2ffb6a0d9a22e6
MD5 27339d7b13be92293432923fb93b5834
BLAKE2b-256 90de3fa940565b6ea52aa28c1d36c9e2108ff867a7e2402bc65e18051756986b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page