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

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: casbin_sqlalchemy_adapter-0.3.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.7

File hashes

Hashes for casbin_sqlalchemy_adapter-0.3.1.tar.gz
Algorithm Hash digest
SHA256 59d68a6360ad3357b5b5d83f8d249e22357f6a5c1ca93af443c54bda4509184b
MD5 bcc8da6f01b93f353fe71fde63371030
BLAKE2b-256 82bd9d06d7fb858ab8c6e2de1619dba4c1bf4ccfcaff2a92fb02a27ac6f83e5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: casbin_sqlalchemy_adapter-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.7

File hashes

Hashes for casbin_sqlalchemy_adapter-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24a05fc7e13c59126fcf075b49a46151bb15caa7b40c1890e66e653cc6ae9a2a
MD5 11e568ec870064619e08b6495d346f22
BLAKE2b-256 d749eec12ca92cdee14e7a9bcdc746776c87024ca3ddc6877e6c0726626f77db

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