SQLObject Adapter for PyCasbin
====
[![GitHub Action](https://github.com/officialpycasbin/sqlobject-adapter/workflows/build/badge.svg)](https://github.com/officialpycasbin/sqlobject-adapter/actions)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/sqlobject-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/sqlobject-adapter)
[![Version](https://img.shields.io/pypi/v/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![Pyversions](https://img.shields.io/pypi/pyversions/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![Download](https://img.shields.io/pypi/dm/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![License](https://img.shields.io/pypi/l/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
SQLObject Adapter is the [SQLObject](http://www.sqlobject.org/index.html) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from SQLObject supported database or save policy to it.
The current supported databases are:
- PostgreSQL
- MySQL
- SQLite
- Microsoft SQL Server
- Firebird
- Sybase
- MAX DB
- pyfirebirdsql
## Installation
```
pip install sqlobject_adapter
```
## Simple Example
```python
import sqlobject_adapter
import casbin
adapter = sqlobject_adapter.Adapter('sqlite:///test.db')
e = casbin.Enforcer('path/to/model.conf', adapter, True)
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 data1casbin_sqlalchemy_adapter
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": null,
"name": "sqlobject-adapter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.4",
"maintainer_email": null,
"keywords": "casbin, SQLObject, casbin-adapter, rbac, access control, abac, acl, permission",
"author": null,
"author_email": "Casbin <admin@casbin.org>",
"download_url": "https://files.pythonhosted.org/packages/f7/09/010e5836f348258afb822a53d1d8c62a60a152dacf9f836e789056cb1ada/sqlobject_adapter-0.3.0.tar.gz",
"platform": null,
"description": "SQLObject Adapter for PyCasbin\n====\n\n[![GitHub Action](https://github.com/officialpycasbin/sqlobject-adapter/workflows/build/badge.svg)](https://github.com/officialpycasbin/sqlobject-adapter/actions)\n[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/sqlobject-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/sqlobject-adapter)\n[![Version](https://img.shields.io/pypi/v/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)\n[![Download](https://img.shields.io/pypi/dm/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)\n[![License](https://img.shields.io/pypi/l/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)\n\nSQLObject Adapter is the [SQLObject](http://www.sqlobject.org/index.html) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from SQLObject supported database or save policy to it.\n\nThe current supported databases are:\n\n- PostgreSQL\n- MySQL\n- SQLite\n- Microsoft SQL Server\n- Firebird\n- Sybase\n- MAX DB\n- pyfirebirdsql\n\n## Installation\n\n```\npip install sqlobject_adapter\n```\n\n## Simple Example\n\n```python\nimport sqlobject_adapter\nimport casbin\n\nadapter = sqlobject_adapter.Adapter('sqlite:///test.db')\n\ne = casbin.Enforcer('path/to/model.conf', adapter, True)\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 data1casbin_sqlalchemy_adapter\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": "SQLObject Adapter for PyCasbin",
"version": "0.3.0",
"project_urls": {
"Home-page": "https://github.com/officialpycasbin/sqlobject-adapter"
},
"split_keywords": [
"casbin",
" sqlobject",
" casbin-adapter",
" rbac",
" access control",
" abac",
" acl",
" permission"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6767619051d19f97f06db96a7636c707445c71d000602de325787b2b663c0b2",
"md5": "65302cbfbc393c79259e56d1b26161bf",
"sha256": "1f5a11e0cfe9744807187e50e2e0ddb7468ddd59de8ac730a0a40b710a461d41"
},
"downloads": -1,
"filename": "sqlobject_adapter-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65302cbfbc393c79259e56d1b26161bf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.4",
"size": 7426,
"upload_time": "2024-10-26T16:47:36",
"upload_time_iso_8601": "2024-10-26T16:47:36.274799Z",
"url": "https://files.pythonhosted.org/packages/d6/76/7619051d19f97f06db96a7636c707445c71d000602de325787b2b663c0b2/sqlobject_adapter-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f709010e5836f348258afb822a53d1d8c62a60a152dacf9f836e789056cb1ada",
"md5": "80be14a272681768ecc38ac93a7e0a4b",
"sha256": "e094d2e3b4e367782a96b2f8f86e4977c874e45d2750690403641d4beb9f74c3"
},
"downloads": -1,
"filename": "sqlobject_adapter-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "80be14a272681768ecc38ac93a7e0a4b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.4",
"size": 7828,
"upload_time": "2024-10-26T16:47:37",
"upload_time_iso_8601": "2024-10-26T16:47:37.612369Z",
"url": "https://files.pythonhosted.org/packages/f7/09/010e5836f348258afb822a53d1d8c62a60a152dacf9f836e789056cb1ada/sqlobject_adapter-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 16:47:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "officialpycasbin",
"github_project": "sqlobject-adapter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "sqlobject-adapter"
}