casbin-async-sqlalchemy-adapter


Namecasbin-async-sqlalchemy-adapter JSON
Version 1.7.0 PyPI version JSON
download
home_pagehttps://github.com/officialpycasbin/async-sqlalchemy-adapter
SummaryAsynchronous SQLAlchemy Adapter for PyCasbin
upload_time2024-12-18 03:07:09
maintainerNone
docs_urlNone
authorCasbin
requires_python>=3.7
licenseApache 2.0
keywords asynccasbin sqlalchemy casbin-adapter rbac access control abac acl permission
VCS
bugtrack_url
requirements SQLAlchemy casbin
Travis-CI No Travis.
coveralls test coverage
            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 casbin

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

# or mysql example 
# adapter = casbin_async_sqlalchemy_adapter.Adapter('mysql+aiomysql://user:pwd@127.0.0.1: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).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/officialpycasbin/async-sqlalchemy-adapter",
    "name": "casbin-async-sqlalchemy-adapter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "asynccasbin, SQLAlchemy, casbin-adapter, rbac, access control, abac, acl, permission",
    "author": "Casbin",
    "author_email": "admin@casbin.org",
    "download_url": "https://files.pythonhosted.org/packages/32/28/52d18166e54b8f36228212d2ee00ee86b41d492cab18973e324e3523ff36/casbin_async_sqlalchemy_adapter-1.7.0.tar.gz",
    "platform": null,
    "description": "async-sqlalchemy-adapter\n====\n\n[![GitHub Actions](https://github.com/officialpycasbin/async-sqlalchemy-adapter/workflows/build/badge.svg?branch=master)](https://github.com/officialpycasbin/async-sqlalchemy-adapter/actions)\n[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/async-sqlalchemy-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/async-sqlalchemy-adapter)\n[![Version](https://img.shields.io/pypi/v/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)\n[![Download](https://img.shields.io/pypi/dm/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)\n[![License](https://img.shields.io/pypi/l/casbin_async_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_async_sqlalchemy_adapter/)\n\nAsynchronous 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.\n\nBased on [Officially Supported Databases](http://www.sqlalchemy.org/), The current supported databases are:\n\n- PostgreSQL\n- MySQL\n- MariaDB\n- SQLite\n- Oracle\n- Microsoft SQL Server\n- Firebird\n\n## Installation\n\n```\npip install casbin_async_sqlalchemy_adapter\n```\n\n## Simple Example\n\n```python\nimport casbin_async_sqlalchemy_adapter\nimport casbin\n\nadapter = casbin_async_sqlalchemy_adapter.Adapter('sqlite+aiosqlite:///test.db')\n\n# or mysql example \n# adapter = casbin_async_sqlalchemy_adapter.Adapter('mysql+aiomysql://user:pwd@127.0.0.1:3306/exampledb')\n\ne = casbin.AsyncEnforcer('path/to/model.conf', adapter)\n\nsub = \"alice\"  # the user that wants to access a resource.\nobj = \"data1\"  # the resource that is going to be accessed.\nact = \"read\"  # the operation that the user performs on the resource.\n\nif e.enforce(sub, obj, act):\n    # permit alice to read data1\n    pass\nelse:\n    # deny the request, show an error\n    pass\n```\n\n> Note that AsyncAdaper must be used for AynscEnforcer.\n\n### Getting Help\n\n- [PyCasbin](https://github.com/casbin/pycasbin)\n\n### License\n\nThis project is licensed under the [Apache 2.0 license](LICENSE).\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Asynchronous SQLAlchemy Adapter for PyCasbin",
    "version": "1.7.0",
    "project_urls": {
        "Homepage": "https://github.com/officialpycasbin/async-sqlalchemy-adapter"
    },
    "split_keywords": [
        "asynccasbin",
        " sqlalchemy",
        " casbin-adapter",
        " rbac",
        " access control",
        " abac",
        " acl",
        " permission"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5af31fa59284c75e6497d1184459e4743f1ceb39125becca0ca0d67c4f385356",
                "md5": "8fac0c3896613cde11ca11cdd730d976",
                "sha256": "d0a1ede29303a11eaa79e258579536b45267373cbd8f03e047ae1a399b92344b"
            },
            "downloads": -1,
            "filename": "casbin_async_sqlalchemy_adapter-1.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8fac0c3896613cde11ca11cdd730d976",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11293,
            "upload_time": "2024-12-18T03:07:08",
            "upload_time_iso_8601": "2024-12-18T03:07:08.092018Z",
            "url": "https://files.pythonhosted.org/packages/5a/f3/1fa59284c75e6497d1184459e4743f1ceb39125becca0ca0d67c4f385356/casbin_async_sqlalchemy_adapter-1.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "322852d18166e54b8f36228212d2ee00ee86b41d492cab18973e324e3523ff36",
                "md5": "45920fe167cf675416dc11cce4c1a7a2",
                "sha256": "c946bdbb6c1f9a458fc75e86ac5565fd5f0c07704b78d4b57c257b97a06b5c68"
            },
            "downloads": -1,
            "filename": "casbin_async_sqlalchemy_adapter-1.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "45920fe167cf675416dc11cce4c1a7a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10946,
            "upload_time": "2024-12-18T03:07:09",
            "upload_time_iso_8601": "2024-12-18T03:07:09.043860Z",
            "url": "https://files.pythonhosted.org/packages/32/28/52d18166e54b8f36228212d2ee00ee86b41d492cab18973e324e3523ff36/casbin_async_sqlalchemy_adapter-1.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 03:07:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "officialpycasbin",
    "github_project": "async-sqlalchemy-adapter",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "SQLAlchemy",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "casbin",
            "specs": [
                [
                    ">=",
                    "1.34.0"
                ]
            ]
        }
    ],
    "lcname": "casbin-async-sqlalchemy-adapter"
}
        
Elapsed time: 0.44606s