Asynchronous SQLAlchemy Adapter for PyCasbin
Project description
async-sqlalchemy-adapter
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
- MariaDB
- SQLite
- Oracle
- Microsoft SQL Server
- Firebird
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for casbin_async_sqlalchemy_adapter-1.6.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2274cc319f2fe6357bef43353cf58e07850d13a22e38a8c0dcc108e5cf923fb1 |
|
MD5 | c5a382415592ffef234a423a1ea73141 |
|
BLAKE2b-256 | 157a72704944f7eb059ed984b7caa7a349261b4f472c2239fa4f61d2f53e71e1 |
Close
Hashes for casbin_async_sqlalchemy_adapter-1.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40ab331fef05e9a7e8fe095ceafce7363f95c3431c3fa3011a571ed6e8b09041 |
|
MD5 | b24fddf6e934bcc649fcf5233495aaae |
|
BLAKE2b-256 | e9af75bc636010b2fce9e0eb29d16c13650c4f398544c19ef4abda3d4d62e7c2 |