Skip to main content

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

Project description

postgresql-watcher

Build Status Coverage Status Version PyPI - Wheel Pyversions Download Discord

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


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-1.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

casbin_postgresql_watcher-1.1.0-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file casbin_postgresql_watcher-1.1.0.tar.gz.

File metadata

File hashes

Hashes for casbin_postgresql_watcher-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9a5827e2fe1aa35b7111da182ee1446e1013cdd345ed66a686108bafe25efc51
MD5 956c7cd69808e376233c870bf9eefa4d
BLAKE2b-256 e5be9e9d69d81fbfa0da99997e7fa3219d6dd1aa6e3bed6ffa4326f4799c7756

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_postgresql_watcher-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8f1c2addffe7b2cd1a7ea104d032fcdd02693c006d501e32cc93dcb0ca56427d
MD5 1199d427e19b80070335c3c8b1ad03af
BLAKE2b-256 0496e561d0ed06fd8bb0d469b5eb4f0070232e0db466e4ad6483af09da788c01

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