Skip to main content

Asynchronous SQLAlchemy Adapter for PyCasbin

Project description

async-sqlalchemy-adapter

Async SQLAlchemy Adapter for PyCasbin
GitHub Actions Coverage Status Version PyPI - Wheel Pyversions Download License

Asynchronous 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_async_sqlalchemy_adapter

Simple Example

import casbin_async_sqlalchemy_adapter
import casbin

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

e = casbin.Enforcer('path/to/model.conf', adapter)

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 data1
    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_async_sqlalchemy_adapter-1.0.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file casbin_async_sqlalchemy_adapter-1.0.1.tar.gz.

File metadata

File hashes

Hashes for casbin_async_sqlalchemy_adapter-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fefa459c441c490fd43b7eb19b4eb48e7677fab994ac8c5fb2873d62f5157e0a
MD5 ce2bc6c90d4d292254e72d9d491f9a29
BLAKE2b-256 b424fa62881351764ce83af55fb35837b3e5b5681795527536c4b10a8ec903cd

See more details on using hashes here.

File details

Details for the file casbin_async_sqlalchemy_adapter-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for casbin_async_sqlalchemy_adapter-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fdad7ce2271611bd330c6efa250cdf138787fae17bbb4ba17bc9f1daada47a6e
MD5 4570967f817df49dcb4a43fc45f8326a
BLAKE2b-256 315e1227c16002bb55f188a487930ef16c0dd35e7bad9feb090d35a66f349c6d

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