chore(release): 1.1.0 [skip ci]

# [1.1.0](https://github.com/pycasbin/rabbitmq-watcher/compare/v1.0.0...v1.1.0) (2023-07-05)

### Features

* Update README.md ([bdd2f7a](https://github.com/pycasbin/rabbitmq-watcher/commit/bdd2f7a62e32dea7cf91df4100864349aa806494))
2 files changed
tree: 3faf7c42fc5f1f22b0da5dd204502995d8d38fed
  1. .github/
  2. casbin_rabbitmq_watcher/
  3. examples/
  4. tests/
  5. .gitignore
  6. .releaserc.json
  7. CHANGELOG.md
  8. LICENSE
  9. README.md
  10. requirements.txt
  11. setup.cfg
  12. setup.py
README.md

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.