Skip to main content

SQLAlchemy Adapter for PyCasbin

Project description

SQLAlchemy Adapter for PyCasbin

Build Status Coverage Status Version PyPI - Wheel Pyversions Download License

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

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

  • PostgreSQL
  • MySQL
  • SQLite
  • Oracle
  • Microsoft SQL Server
  • Firebird
  • Sybase

Installation

pip install casbin_sqlalchemy_adapter

Simple Example

import casbin_sqlalchemy_adapter
import casbin

adapter = casbin_sqlalchemy_adapter.Adapter('sqlite:///test.db')

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_sqlalchemy_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_sqlalchemy_adapter-0.0.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: casbin_sqlalchemy_adapter-0.0.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for casbin_sqlalchemy_adapter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6edcd12b38b998d4f711b64cb313877252b56277347a65e47d6a1cf106dbfc18
MD5 e0a33485ae5668f8cb9e9da644e61192
BLAKE2b-256 1edeac8540ff79f9a768443415309ef5984003e072cc88abc6b8aa7e17f7cb76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: casbin_sqlalchemy_adapter-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for casbin_sqlalchemy_adapter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65f44fd4c890b9ffd8e3ea292ed37e6ac9983b9e13a5de7067f33893921192a1
MD5 4e7d8e72629b295ac18f62cdfea4b175
BLAKE2b-256 9fbd121a7162d1d96a9cb578e6bdbbcbefad0cdaf3c69ce7b73df9b96f6b14cf

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