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))
Rabbitmq Watcher is the rabbitmq watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
pip install casbin-rabbitmq-watcher
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()
This project is under Apache 2.0 License. See the LICENSE file for the full license text.