Skip to main content

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

Project description

rabbitmq-watcher

Build Status Coverage Status Version PyPI - Wheel Pyversions Download Discord

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

casbin_rabbitmq_watcher-1.4.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file casbin_rabbitmq_watcher-1.4.0.tar.gz.

File metadata

File hashes

Hashes for casbin_rabbitmq_watcher-1.4.0.tar.gz
Algorithm Hash digest
SHA256 ba201489f5cf1e4da942d8038c02e82b504c27d36d4d332a9ad2435f48110037
MD5 212effb53b36784c32ac9861bb355f11
BLAKE2b-256 b9c0b01f0413f4901d602859e1b66c4e8243702ace6b07ad40a0824e85444409

See more details on using hashes here.

Provenance

File details

Details for the file casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 155a44460436369124e657a85006d20aa0c23540c1631070f2b1d22d01814aab
MD5 82700152b8dcd63ea5a705421a376313
BLAKE2b-256 250e104d76d26c2c5b4d10b7939fca1be6c4b6f6e9632f1467cbf10637886265

See more details on using hashes here.

Provenance

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