https://github.com/officialpycasbin/rabbitmq-watcher
RabbitMQ Watcher for PyCasbin
https://github.com/officialpycasbin/rabbitmq-watcher
abac acl auth authorization authz casbin middleware pycasbin rabbitmq rbac watcher
Last synced: 3 months ago
JSON representation
RabbitMQ Watcher for PyCasbin
- Host: GitHub
- URL: https://github.com/officialpycasbin/rabbitmq-watcher
- Owner: officialpycasbin
- License: apache-2.0
- Created: 2024-11-12T01:04:14.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-02-26T13:39:13.000Z (4 months ago)
- Last Synced: 2025-04-12T09:53:05.356Z (3 months ago)
- Topics: abac, acl, auth, authorization, authz, casbin, middleware, pycasbin, rabbitmq, rbac, watcher
- Language: Python
- Homepage: https://github.com/casbin/pycasbin
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# rabbitmq-watcher
[](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml)
[](https://coveralls.io/github/officialpycasbin/rabbitmq-watcher)
[](https://pypi.org/project/casbin-rabbitmq-watcher/)
[](https://pypi.org/project/casbin-rabbitmq-watcher/)
[](https://pypi.org/project/casbin-rabbitmq-watcher/)
[](https://pypi.org/project/casbin-rabbitmq-watcher/)
[](https://discord.gg/S5UjpzGZjN)Rabbitmq Watcher is the rabbitmq watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
## Installation
```bash
pip install casbin-rabbitmq-watcher
```## Simple Example
```python
import osimport casbin
from casbin_rabbitmq_watcher import new_watcherdef 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
- [Casbin](https://github.com/casbin/pycasbin)
## License
This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.