Skip to main content

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

Project description

rabbitmq-watcher

tests Coverage Status Version PyPI - Wheel Download Gitter

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

Uploaded Source

Built Distribution

casbin_rabbitmq_watcher-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for casbin-rabbitmq-watcher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8d7b2250ec6a52b4358b647f68e495d18a2217848b52857df81d6322c80f64d5
MD5 b2019bb21dae1dc95993e6b8bf4e6b7c
BLAKE2b-256 ecb1fb2acb76b7c8c4d7d9c9112b686e5557342a27a4810e4073f75c1fdefa7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_rabbitmq_watcher-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c9386600b9e09f3986b6163ee2c5f652f9e0d36d41ebf6177ac5037238a3a52
MD5 40692f5e7cda1ec6ac89e48c4a1913fc
BLAKE2b-256 529cf9c059967ab583d966887d2ee127299f5dfa0b20991e8cbae491d5333c6e

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