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

Uploaded Source

Built Distribution

casbin_postgresql_watcher-0.3.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-0.3.0.tar.gz.

File metadata

File hashes

Hashes for casbin-postgresql-watcher-0.3.0.tar.gz
Algorithm Hash digest
SHA256 343198cb14896090c7ec91f76bd5381202977006ce469c42c13d5bb3fc76ce7e
MD5 a6ac7f68e48317a0aef3fd1f93c4c4dd
BLAKE2b-256 5a7309a09ded47c4e21ce58f5593986de365c15f4ae70c7678c3567025109ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_postgresql_watcher-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9fe78ea06ea534d2afb4480b51c32c3838c24a417a3a22306a20b34cb01b07f4
MD5 eb368785ff46092145ba182a27f991c1
BLAKE2b-256 ad9b28f03e8f59ab1353edcd5746d90e5fde27a09c08539ec2a1898eb1028853

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