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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for casbin-rabbitmq-watcher-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a04af1dbfde46b00df2179f7a5534aa86a9df9c7a3f0b5ad3973e592d3871ef3
MD5 260a3e626a76c0ca1ad0cb2573ff49fb
BLAKE2b-256 e39204303c164a8c0ab6c0f4ea8e2a5114277739e9a6e0266e1f887586c37e70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_rabbitmq_watcher-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d98e03915c0834eaa4c435eed23fb91b238443ebdf2e05837c271c42bf9e0543
MD5 4e7b0a40308e8106d78312fd37747388
BLAKE2b-256 d2a4ca57619d61f0f1be106332957baacd5e58b022f2539de3025c2f9935261c

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