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

Uploaded Source

Built Distribution

casbin_postgresql_watcher-1.0.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.0.0.tar.gz.

File metadata

File hashes

Hashes for casbin-postgresql-watcher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7a88e2edd8806737acdf0d224e701bc0e1bdaf3a5672228edaa1af6e62eff7e3
MD5 3a89ec6c3e8a97b09f76549e7945c6dc
BLAKE2b-256 e0a65cdbd59f970a0d50c126fc5bb65fc6cf4bf0d5449c1ca46c4a3c3dbb2e04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_postgresql_watcher-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9d96fb7046ec8676ec344d14562eaf1794eaeb54cf8549958bb94cff45c099bc
MD5 b5f52c679598b5311384cdb4a038dbc1
BLAKE2b-256 8057199aa25176261b0be600f5f49bb29edd2e6b636d0e892f32fc6f4b724373

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