Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/officialpycasbin/async-sqlalchemy-adapter
Async SQLAlchemy Adapter for PyCasbin
https://github.com/officialpycasbin/async-sqlalchemy-adapter
abac acl adapter async auth authorization authz casbin database db py pycasbin python rbac sqlalchemy
Last synced: 12 days ago
JSON representation
Async SQLAlchemy Adapter for PyCasbin
- Host: GitHub
- URL: https://github.com/officialpycasbin/async-sqlalchemy-adapter
- Owner: officialpycasbin
- License: apache-2.0
- Created: 2024-11-12T02:34:02.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-12-18T03:07:07.000Z (16 days ago)
- Last Synced: 2024-12-18T04:18:07.358Z (16 days ago)
- Topics: abac, acl, adapter, async, auth, authorization, authz, casbin, database, db, py, pycasbin, python, rbac, sqlalchemy
- Language: Python
- Homepage: https://github.com/casbin/pycasbin
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
async-sqlalchemy-adapter
====[![GitHub Actions](https://github.com/officialpycasbin/async-sqlalchemy-adapter/workflows/build/badge.svg?branch=master)](https://github.com/officialpycasbin/async-sqlalchemy-adapter/actions)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/async-sqlalchemy-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/async-sqlalchemy-adapter)
[![Version](https://img.shields.io/pypi/v/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)
[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)
[![Download](https://img.shields.io/pypi/dm/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)
[![License](https://img.shields.io/pypi/l/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)Asynchronous SQLAlchemy Adapter is the [SQLAlchemy](https://www.sqlalchemy.org) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from SQLAlchemy supported database or save policy to it.
Based on [Officially Supported Databases](http://www.sqlalchemy.org/), The current supported databases are:
- PostgreSQL
- MySQL
- MariaDB
- SQLite
- Oracle
- Microsoft SQL Server
- Firebird## Installation
```
pip install casbin_async_sqlalchemy_adapter
```## Simple Example
```python
import casbin_async_sqlalchemy_adapter
import casbinadapter = casbin_async_sqlalchemy_adapter.Adapter('sqlite+aiosqlite:///test.db')
# or mysql example
# adapter = casbin_async_sqlalchemy_adapter.Adapter('mysql+aiomysql://user:[email protected]:3306/exampledb')e = casbin.AsyncEnforcer('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
```> Note that AsyncAdaper must be used for AynscEnforcer.
### Getting Help
- [PyCasbin](https://github.com/casbin/pycasbin)
### License
This project is licensed under the [Apache 2.0 license](LICENSE).