Skip to main content

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

Project description

rabbitmq-watcher

build Coverage Status Version PyPI - Wheel 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.2.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

casbin_rabbitmq_watcher-1.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file casbin-rabbitmq-watcher-1.2.0.tar.gz.

File metadata

File hashes

Hashes for casbin-rabbitmq-watcher-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e66e2d4530efb5dad0de7a99bc47b05e82ba9a279d691654d95a0dae01139aa7
MD5 41ed7f4b6f2e19da6b1e5e1d51d624eb
BLAKE2b-256 764334bb08df49111764026b01136d58d1a3c4716375e002529aa9dc875ef78b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_rabbitmq_watcher-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20e7084016a132cc34fda2b0a7b2d7be24535d9259458562f2050899ea7867d5
MD5 8ae8d6f755c866c9546e4f41612407ae
BLAKE2b-256 4c8431aa8dd3d09e5de94a2f44454d53003cb164b9038fa7de185f2ef31e54c9

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