# rabbitmq-watcher
[![Build Status](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml/badge.svg)](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/rabbitmq-watcher/badge.svg)](https://coveralls.io/github/officialpycasbin/rabbitmq-watcher)
[![Version](https://img.shields.io/pypi/v/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![Pyversions](https://img.shields.io/pypi/pyversions/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![Download](https://img.shields.io/pypi/dm/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](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 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
- [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.
Raw data
{
"_id": null,
"home_page": "https://github.com/officialpycasbin/rabbitmq-watcher",
"name": "casbin-rabbitmq-watcher",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": "casbin, Rabbitmq, casbin-watcher, rbac, access control, abac, acl, permission",
"author": "Casbin",
"author_email": "admin@casbin.org",
"download_url": "https://files.pythonhosted.org/packages/b9/c0/b01f0413f4901d602859e1b66c4e8243702ace6b07ad40a0824e85444409/casbin_rabbitmq_watcher-1.4.0.tar.gz",
"platform": null,
"description": "# rabbitmq-watcher\n\n[![Build Status](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml/badge.svg)](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/rabbitmq-watcher/badge.svg)](https://coveralls.io/github/officialpycasbin/rabbitmq-watcher)\n[![Version](https://img.shields.io/pypi/v/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)\n[![Download](https://img.shields.io/pypi/dm/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\nRabbitmq Watcher is the rabbitmq watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.\n\n## Installation\n\n```bash\npip install casbin-rabbitmq-watcher\n```\n\n## Simple Example\n\n```python\nimport os\n\nimport casbin\nfrom casbin_rabbitmq_watcher import new_watcher\n\n\ndef get_examples(path):\n examples_path = os.path.split(os.path.realpath(__file__))[0] + \"/../examples/\"\n return os.path.abspath(examples_path + path)\n\n\ndef update_callback_func(msg):\n ...\n\n\nwatcher = new_watcher()\nwatcher.set_update_callback(update_callback_func)\n\ne = casbin.Enforcer(\n get_examples(\"rbac_model.conf\"), get_examples(\"rbac_policy.csv\")\n)\n\ne.set_watcher(watcher)\n# update_callback_func will be called\ne.save_policy()\n```\n\n## Getting Help\n\n- [Casbin](https://github.com/casbin/pycasbin)\n\n## License\n\nThis project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Casbin role watcher to be used for monitoring updates to policies for PyCasbin",
"version": "1.4.0",
"project_urls": {
"Homepage": "https://github.com/officialpycasbin/rabbitmq-watcher"
},
"split_keywords": [
"casbin",
" rabbitmq",
" casbin-watcher",
" rbac",
" access control",
" abac",
" acl",
" permission"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "250e104d76d26c2c5b4d10b7939fca1be6c4b6f6e9632f1467cbf10637886265",
"md5": "82700152b8dcd63ea5a705421a376313",
"sha256": "155a44460436369124e657a85006d20aa0c23540c1631070f2b1d22d01814aab"
},
"downloads": -1,
"filename": "casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "82700152b8dcd63ea5a705421a376313",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 9654,
"upload_time": "2024-11-12T01:49:17",
"upload_time_iso_8601": "2024-11-12T01:49:17.127284Z",
"url": "https://files.pythonhosted.org/packages/25/0e/104d76d26c2c5b4d10b7939fca1be6c4b6f6e9632f1467cbf10637886265/casbin_rabbitmq_watcher-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b9c0b01f0413f4901d602859e1b66c4e8243702ace6b07ad40a0824e85444409",
"md5": "212effb53b36784c32ac9861bb355f11",
"sha256": "ba201489f5cf1e4da942d8038c02e82b504c27d36d4d332a9ad2435f48110037"
},
"downloads": -1,
"filename": "casbin_rabbitmq_watcher-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "212effb53b36784c32ac9861bb355f11",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 8808,
"upload_time": "2024-11-12T01:49:18",
"upload_time_iso_8601": "2024-11-12T01:49:18.745465Z",
"url": "https://files.pythonhosted.org/packages/b9/c0/b01f0413f4901d602859e1b66c4e8243702ace6b07ad40a0824e85444409/casbin_rabbitmq_watcher-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-12 01:49:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "officialpycasbin",
"github_project": "rabbitmq-watcher",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "casbin-rabbitmq-watcher"
}