Skip to main content

Casbin role watcher to be used for monitoring updates to policies for PyCasbin

Project description

postgresql-watcher

tests Coverage Status Version PyPI - Wheel Download Gitter

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

casbin-postgresql-watcher-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

casbin_postgresql_watcher-0.2.0-py2.py3-none-any.whl (8.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file casbin-postgresql-watcher-0.2.0.tar.gz.

File metadata

File hashes

Hashes for casbin-postgresql-watcher-0.2.0.tar.gz
Algorithm Hash digest
SHA256 03fc2da0bf0df7203d8f1d0c16b526363feafce32a442c2e476441738994177e
MD5 b9732a89ed87267c84ab51c7b030bdd3
BLAKE2b-256 89881f728f0264fa48e3277eef821c46705623279077eed3c63ab6adbcfb8540

See more details on using hashes here.

File details

Details for the file casbin_postgresql_watcher-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for casbin_postgresql_watcher-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 654d30abcaed7f0dee3ddb315b776d98b0fce48e3d03099e8d148f6f43d2aa80
MD5 d9c61d3dbb8bb6c0e9ddd7ce1232dd1c
BLAKE2b-256 02a2253d12e10305036a3067988cbe996bff563e639d54ee68c30715f23665dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page