# rabbitmq-watcher
[![Build Status](https://github.com/pycasbin/rabbitmq-watcher/actions/workflows/build.yml/badge.svg)](https://github.com/pycasbin/rabbitmq-watcher/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/pycasbin/rabbitmq-watcher/badge.svg)](https://coveralls.io/github/pycasbin/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/pycasbin/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": "BustDot",
"author_email": "Bust.dev@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/f3/06/cb84722429d53c981f4ea7e426755a66bd9d3eb95f7a893e3bcb13d28f44/casbin-rabbitmq-watcher-1.3.0.tar.gz",
"platform": null,
"description": "# rabbitmq-watcher\n\n[![Build Status](https://github.com/pycasbin/rabbitmq-watcher/actions/workflows/build.yml/badge.svg)](https://github.com/pycasbin/rabbitmq-watcher/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/pycasbin/rabbitmq-watcher/badge.svg)](https://coveralls.io/github/pycasbin/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## Installation\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.3.0",
"project_urls": {
"Homepage": "https://github.com/pycasbin/rabbitmq-watcher"
},
"split_keywords": [
"casbin",
" rabbitmq",
" casbin-watcher",
" rbac",
" access control",
" abac",
" acl",
" permission"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f509b8c2c5e06116f1ab1533a338cd3276ec74dec2f069e4379b136d61e31a14",
"md5": "12bc9a3e455714e31ce6f06d393ad923",
"sha256": "768a4dbe42aef0526f4b4346207c6afa9ed74afa964f21607f801e1e2154f9f6"
},
"downloads": -1,
"filename": "casbin_rabbitmq_watcher-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "12bc9a3e455714e31ce6f06d393ad923",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 9649,
"upload_time": "2024-03-29T13:27:01",
"upload_time_iso_8601": "2024-03-29T13:27:01.083851Z",
"url": "https://files.pythonhosted.org/packages/f5/09/b8c2c5e06116f1ab1533a338cd3276ec74dec2f069e4379b136d61e31a14/casbin_rabbitmq_watcher-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f306cb84722429d53c981f4ea7e426755a66bd9d3eb95f7a893e3bcb13d28f44",
"md5": "96b51d37042f3d48bcf3f5871610eb8f",
"sha256": "1d9139a6763c19bc7e5d15316d940ce10991d75d3e17f93c8c33064da529a77c"
},
"downloads": -1,
"filename": "casbin-rabbitmq-watcher-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "96b51d37042f3d48bcf3f5871610eb8f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 8787,
"upload_time": "2024-03-29T13:27:03",
"upload_time_iso_8601": "2024-03-29T13:27:03.069828Z",
"url": "https://files.pythonhosted.org/packages/f3/06/cb84722429d53c981f4ea7e426755a66bd9d3eb95f7a893e3bcb13d28f44/casbin-rabbitmq-watcher-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-29 13:27:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pycasbin",
"github_project": "rabbitmq-watcher",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "casbin-rabbitmq-watcher"
}