Casbin role watcher to be used for monitoring updates to policies for PyCasbin
Project description
rabbitmq-watcher
Rabbitmq Watcher is the rabbitmq watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
Installation
pip install casbin-rabbitmq-watcher
Simple Example
import os
import casbin
from casbin_rabbitmq_watcher import new_watcher
def get_examples(path):
examples_path = os.path.split(os.path.realpath(__file__))[0] + "/../examples/"
return os.path.abspath(examples_path + path)
def update_callback_func(msg):
...
watcher = new_watcher()
watcher.set_update_callback(update_callback_func)
e = casbin.Enforcer(
get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
)
e.set_watcher(watcher)
# update_callback_func will be called
e.save_policy()
Getting Help
License
This project is under Apache 2.0 License. See the LICENSE file for the full license text.
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
Built Distribution
File details
Details for the file casbin_rabbitmq_watcher-1.4.0.tar.gz
.
File metadata
- Download URL: casbin_rabbitmq_watcher-1.4.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba201489f5cf1e4da942d8038c02e82b504c27d36d4d332a9ad2435f48110037 |
|
MD5 | 212effb53b36784c32ac9861bb355f11 |
|
BLAKE2b-256 | b9c0b01f0413f4901d602859e1b66c4e8243702ace6b07ad40a0824e85444409 |
Provenance
File details
Details for the file casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 155a44460436369124e657a85006d20aa0c23540c1631070f2b1d22d01814aab |
|
MD5 | 82700152b8dcd63ea5a705421a376313 |
|
BLAKE2b-256 | 250e104d76d26c2c5b4d10b7939fca1be6c4b6f6e9632f1467cbf10637886265 |