Casbin role watcher to be used for monitoring updates to policies for PyCasbin
Project description
postgresql-watcher
Casbin role watcher to be used for monitoring updates to casbin policies
Installation
pip install casbin-postgresql-watcher
Basic Usage Example
With Flask-authz
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 for full details of SSL parameters.
With Flask-authz
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file casbin-postgresql-watcher-0.2.0.tar.gz
.
File metadata
- Download URL: casbin-postgresql-watcher-0.2.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03fc2da0bf0df7203d8f1d0c16b526363feafce32a442c2e476441738994177e |
|
MD5 | b9732a89ed87267c84ab51c7b030bdd3 |
|
BLAKE2b-256 | 89881f728f0264fa48e3277eef821c46705623279077eed3c63ab6adbcfb8540 |
File details
Details for the file casbin_postgresql_watcher-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: casbin_postgresql_watcher-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 654d30abcaed7f0dee3ddb315b776d98b0fce48e3d03099e8d148f6f43d2aa80 |
|
MD5 | d9c61d3dbb8bb6c0e9ddd7ce1232dd1c |
|
BLAKE2b-256 | 02a2253d12e10305036a3067988cbe996bff563e639d54ee68c30715f23665dd |