Casbin role watcher to be used for monitoring updates to policies for PyCasbin
Project description
postgresql-watcher
Casbin watcher based on PostgreSQL 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-1.1.0.tar.gz
.
File metadata
- Download URL: casbin_postgresql_watcher-1.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a5827e2fe1aa35b7111da182ee1446e1013cdd345ed66a686108bafe25efc51 |
|
MD5 | 956c7cd69808e376233c870bf9eefa4d |
|
BLAKE2b-256 | e5be9e9d69d81fbfa0da99997e7fa3219d6dd1aa6e3bed6ffa4326f4799c7756 |
File details
Details for the file casbin_postgresql_watcher-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: casbin_postgresql_watcher-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f1c2addffe7b2cd1a7ea104d032fcdd02693c006d501e32cc93dcb0ca56427d |
|
MD5 | 1199d427e19b80070335c3c8b1ad03af |
|
BLAKE2b-256 | 0496e561d0ed06fd8bb0d469b5eb4f0070232e0db466e4ad6483af09da788c01 |