casbin-peewee-adapter-0.0.2
توضیحات
Peewee Adapter for PyCasbin
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | casbin-peewee-adapter-0.0.2 |
| نام | casbin-peewee-adapter |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Huang Yan |
| ایمیل نویسنده | hyor@foxmail.com |
| آدرس صفحه اصلی | https://github.com/shblhy/peewee-adapter |
| آدرس اینترنتی | https://pypi.org/project/casbin-peewee-adapter/ |
| مجوز | Apache 2.0 |
Peewee Adapter for PyCasbin
====
[](https://www.travis-ci.org/pycasbin/peewee-adapter)
[](https://coveralls.io/github/pycasbin/peewee-adapter)
[](https://pypi.org/project/casbin_peewee_adapter/)
[](https://pypi.org/project/casbin_peewee_adapter/)
[](https://pypi.org/project/casbin_peewee_adapter/)
[](https://pypi.org/project/casbin_peewee_adapter/)
[](https://pypi.org/project/casbin_peewee_adapter/)
Peewee Adapter is the [Peewee](http://docs.peewee-orm.com/en/latest/) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from Peewee supported database or save policy to it.
Based on [Officially Supported Databases](http://docs.peewee-orm.com/en/latest/), The current supported databases are:
- PostgreSQL
- MySQL
- SQLite
## Installation
```
pip install casbin_peewee_adapter
```
## Simple Example
```python
import casbin_peewee_adapter
import casbin
import peewee
DATABAEE = peewee.SqliteDatabase('db.sqlite3')
adapter = casbin_peewee_adapter.Adapter(database=DATABAEE)
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_peewee_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).
نیازمندی
| مقدار | نام |
|---|---|
| >=0.2 | casbin |
| >=3.1.0 | peewee |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.3 | Python |
نحوه نصب
نصب پکیج whl casbin-peewee-adapter-0.0.2:
pip install casbin-peewee-adapter-0.0.2.whl
نصب پکیج tar.gz casbin-peewee-adapter-0.0.2:
pip install casbin-peewee-adapter-0.0.2.tar.gz