chore(release): 1.0.0 [skip ci]

# 1.0.0 (2023-07-05)

### Features

* add tests ([0ce79ef](https://github.com/pycasbin/rabbitmq-watcher/commit/0ce79ef9e451f5fdd7d56c74b08ddafe86b0cfb3))
* add thread for sub_watcher ([294f5e5](https://github.com/pycasbin/rabbitmq-watcher/commit/294f5e53296ceee428a29437d91616394da2b151))
* add unit tests ([5f0e35d](https://github.com/pycasbin/rabbitmq-watcher/commit/5f0e35d4ad6c69d5a8b62e106b02bfd69a4c8d1c))
* change to fanout pattern ([735e7f4](https://github.com/pycasbin/rabbitmq-watcher/commit/735e7f44b393cf2be4c698f2939feb26c18f1947))
* complete rabbitmq-watcher ([b70f48d](https://github.com/pycasbin/rabbitmq-watcher/commit/b70f48d1e6ebdb7c9b3961e0ffd2b83fbfb554de))
* init rabbitmq-watcher ([4b35f59](https://github.com/pycasbin/rabbitmq-watcher/commit/4b35f597dd822cfa1414dbb76e8739d715be4d57))
2 files changed
tree: 77cbc71574a466c6edd2a1e3201d0437fa0d2c4a
  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

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.