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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: casbin_rabbitmq_watcher-1.5.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.9

File hashes

Hashes for casbin_rabbitmq_watcher-1.5.0.tar.gz
Algorithm Hash digest
SHA256 265b5b70b93a6c9e59f83f5c840c83bd225246301eef6c2cd193d1f85e29dfd9
MD5 c2c25dbab83810612bbc2f9dd604f61b
BLAKE2b-256 ddf61e748d776ae16b5103459f50164734aeaf7bb5d02f0ed589c5faa60fa82d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_rabbitmq_watcher-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3d8bd9cf0be7cfabc0543ac99bc4eb75d23a841d4e17dd1401c23bbd85225af
MD5 11340c5a1fb85f4c6fe73edf83111f7b
BLAKE2b-256 eeb992cb9be93109faf25eacfda147522118f4e9ff152b2ea74d411950b72003

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page