Metadata-Version: 2.2
Name: casbin-rabbitmq-watcher
Version: 1.5.0
Summary: Casbin role watcher to be used for monitoring updates to policies for PyCasbin
Home-page: https://github.com/officialpycasbin/rabbitmq-watcher
Author: Casbin
Author-email: admin@casbin.org
License: Apache 2.0
Keywords: casbin,Rabbitmq,casbin-watcher,rbac,access control,abac,acl,permission
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.5
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: casbin>=1.16.8
Requires-Dist: pika>=1.3.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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.
