casbin-sqlalchemy-adapter


Namecasbin-sqlalchemy-adapter JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/pycasbin/sqlalchemy-adapter
SummarySQLAlchemy Adapter for PyCasbin
upload_time2024-07-06 14:45:39
maintainerNone
docs_urlNone
authorTechLee
requires_python>=3.3
licenseApache 2.0
keywords casbin sqlalchemy casbin-adapter rbac access control abac acl permission
VCS
bugtrack_url
requirements casbin SQLAlchemy
Travis-CI No Travis.
coveralls test coverage
            SQLAlchemy Adapter for PyCasbin 
====

[![GitHub Actions](https://github.com/pycasbin/sqlalchemy-adapter/workflows/build/badge.svg?branch=master)](https://github.com/pycasbin/sqlalchemy-adapter/actions)
[![Coverage Status](https://coveralls.io/repos/github/pycasbin/sqlalchemy-adapter/badge.svg)](https://coveralls.io/github/pycasbin/sqlalchemy-adapter)
[![Version](https://img.shields.io/pypi/v/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)
[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)
[![Download](https://img.shields.io/pypi/dm/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)
[![License](https://img.shields.io/pypi/l/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)

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
- SQLite
- Oracle
- Microsoft SQL Server
- Firebird
- Sybase

## Installation

```
pip install casbin_sqlalchemy_adapter
```

## Simple Example

```python
import casbin_sqlalchemy_adapter
import casbin

adapter = casbin_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

- [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/pycasbin/sqlalchemy-adapter",
    "name": "casbin-sqlalchemy-adapter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.3",
    "maintainer_email": null,
    "keywords": "casbin, SQLAlchemy, casbin-adapter, rbac, access control, abac, acl, permission",
    "author": "TechLee",
    "author_email": "techlee@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/75/84/916a2d9b3ad71a25e5e208ed9121ca0e3cfebe8b80a76d018a19809c85e3/casbin_sqlalchemy_adapter-1.3.0.tar.gz",
    "platform": null,
    "description": "SQLAlchemy Adapter for PyCasbin \n====\n\n[![GitHub Actions](https://github.com/pycasbin/sqlalchemy-adapter/workflows/build/badge.svg?branch=master)](https://github.com/pycasbin/sqlalchemy-adapter/actions)\n[![Coverage Status](https://coveralls.io/repos/github/pycasbin/sqlalchemy-adapter/badge.svg)](https://coveralls.io/github/pycasbin/sqlalchemy-adapter)\n[![Version](https://img.shields.io/pypi/v/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)\n[![Download](https://img.shields.io/pypi/dm/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)\n[![License](https://img.shields.io/pypi/l/casbin_sqlalchemy_adapter.svg)](https://pypi.org/project/casbin_sqlalchemy_adapter/)\n\nSQLAlchemy 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- SQLite\n- Oracle\n- Microsoft SQL Server\n- Firebird\n- Sybase\n\n## Installation\n\n```\npip install casbin_sqlalchemy_adapter\n```\n\n## Simple Example\n\n```python\nimport casbin_sqlalchemy_adapter\nimport casbin\n\nadapter = casbin_sqlalchemy_adapter.Adapter('sqlite:///test.db')\n\ne = casbin.Enforcer('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\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": "SQLAlchemy Adapter for PyCasbin",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/pycasbin/sqlalchemy-adapter"
    },
    "split_keywords": [
        "casbin",
        " sqlalchemy",
        " casbin-adapter",
        " rbac",
        " access control",
        " abac",
        " acl",
        " permission"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "856844c892c28989ce136fa3cc90587260d33fbc6225441359b22d815f99a527",
                "md5": "8d6d4ba8f93c2ad772b350bf37620cb9",
                "sha256": "eea2e6d267356a70c9dfb957d7f172548ab67da22a8044783443aff7388ed6a3"
            },
            "downloads": -1,
            "filename": "casbin_sqlalchemy_adapter-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d6d4ba8f93c2ad772b350bf37620cb9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.3",
            "size": 9100,
            "upload_time": "2024-07-06T14:45:37",
            "upload_time_iso_8601": "2024-07-06T14:45:37.186728Z",
            "url": "https://files.pythonhosted.org/packages/85/68/44c892c28989ce136fa3cc90587260d33fbc6225441359b22d815f99a527/casbin_sqlalchemy_adapter-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7584916a2d9b3ad71a25e5e208ed9121ca0e3cfebe8b80a76d018a19809c85e3",
                "md5": "1ff7e5c8d2ca9dda0e683e843feb4931",
                "sha256": "f41c19a1c15695ea971aa998be2936a4214859708b807b3534da41945ad37e75"
            },
            "downloads": -1,
            "filename": "casbin_sqlalchemy_adapter-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ff7e5c8d2ca9dda0e683e843feb4931",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.3",
            "size": 10523,
            "upload_time": "2024-07-06T14:45:39",
            "upload_time_iso_8601": "2024-07-06T14:45:39.050791Z",
            "url": "https://files.pythonhosted.org/packages/75/84/916a2d9b3ad71a25e5e208ed9121ca0e3cfebe8b80a76d018a19809c85e3/casbin_sqlalchemy_adapter-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-06 14:45:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pycasbin",
    "github_project": "sqlalchemy-adapter",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "casbin",
            "specs": [
                [
                    ">=",
                    "0.8.1"
                ]
            ]
        },
        {
            "name": "SQLAlchemy",
            "specs": [
                [
                    ">=",
                    "1.2.18"
                ]
            ]
        }
    ],
    "lcname": "casbin-sqlalchemy-adapter"
}
        
Elapsed time: 0.26710s