casbin-postgresql-watcher-0.2.0
توضیحات
Casbin role watcher to be used for monitoring updates to policies for PyCasbin
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | casbin-postgresql-watcher-0.2.0 |
| نام | casbin-postgresql-watcher |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | hsluoyz |
| ایمیل نویسنده | hsluoyz@gmail.com |
| آدرس صفحه اصلی | https://github.com/pycasbin/postgresql-watcher |
| آدرس اینترنتی | https://pypi.org/project/casbin-postgresql-watcher/ |
| مجوز | - |
# postgresql-watcher
[](https://github.com/pycasbin/postgresql-watcher/actions/workflows/release.yml)
[](https://coveralls.io/github/pycasbin/postgresql-watcher)
[](https://pypi.org/project/casbin-postgresql-watcher/)
[](https://pypi.org/project/casbin-postgresql-watcher/)
[](https://pypi.org/project/casbin-postgresql-watcher/)
[](https://gitter.im/casbin/lobby)
Casbin role watcher to be used for monitoring updates to casbin policies
## Installation
```bash
pip install casbin-postgresql-watcher
```
## Basic Usage Example
### With Flask-authz
```python
from flask_authz import CasbinEnforcer
from postgresql_watcher import PostgresqlWatcher
from flask import Flask
from casbin.persist.adapters import FileAdapter
casbin_enforcer = CasbinEnforcer(app, adapter)
watcher = PostgresqlWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME)
watcher.set_update_callback(casbin_enforcer.e.load_policy)
casbin_enforcer.set_watcher(watcher)
```
## Basic Usage Example With SSL Enabled
See [PostgresQL documentation](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS) for full details of SSL parameters.
### With Flask-authz
```python
from flask_authz import CasbinEnforcer
from postgresql_watcher import PostgresqlWatcher
from flask import Flask
from casbin.persist.adapters import FileAdapter
casbin_enforcer = CasbinEnforcer(app, adapter)
watcher = PostgresqlWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME, sslmode="verify_full", sslcert=SSLCERT, sslrootcert=SSLROOTCERT, sslkey=SSLKEY)
watcher.set_update_callback(casbin_enforcer.e.load_policy)
casbin_enforcer.set_watcher(watcher)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=0.8.4 | casbin |
| >=2.8.6 | psycopg2-binary |
| ==20.8b1 | black |
نحوه نصب
نصب پکیج whl casbin-postgresql-watcher-0.2.0:
pip install casbin-postgresql-watcher-0.2.0.whl
نصب پکیج tar.gz casbin-postgresql-watcher-0.2.0:
pip install casbin-postgresql-watcher-0.2.0.tar.gz