initial commit
8 files changed
tree: d57ec9ed03cdf8b8f67bb678809491795c53cba6
  1. examples/
  2. postgresql_watcher/
  3. tests/
  4. .gitignore
  5. dev_requirements.txt
  6. LICENSE
  7. README.md
  8. requirements.txt
README.md

postgresql-watcher

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

Installation

pip install 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)
watcher.set_update_callback(casbin_enforcer.e.load_policy())
casbin_enforcer.set_watcher(watcher)