redis-watcher
redis-watcher is the Redis watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
Installation
pip install redis-watcher
Simple Example
import os
import casbin
from redis_watcher import new_watcher, WatcherOptions
def callback_function(event):
print("update for remove filtered policy callback, event: {}".format(event))
def get_examples(path):
examples_path = os.path.split(os.path.realpath(__file__))[0] + "/../examples/"
return os.path.abspath(examples_path + path)
if __name__ == "main":
test_option = WatcherOptions()
test_option.host = "localhost"
test_option.port = "6379"
test_option.channel = "test"
test_option.ssl = False
test_option.optional_update_callback = callback_function
w = new_watcher(test_option)
e = casbin.Enforcer(
get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
)
e.set_watcher(w)
# then the callback function will be called when the policy is updated.
e.save_policy()
Getting Help
License
This project is under Apache 2.0 License. See the LICENSE file for the full license text.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
redis_watcher-1.8.0.tar.gz
(368.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
redis_watcher-1.8.0-py3-none-any.whl
(403.5 kB
view details)
File details
Details for the file redis_watcher-1.8.0.tar.gz.
File metadata
- Download URL: redis_watcher-1.8.0.tar.gz
- Upload date:
- Size: 368.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb5b813881db98d57df36256850b66496329eafcd974a75de82e6531fcb7c352
|
|
| MD5 |
04c4d6d34a89ccec11547ea91083a460
|
|
| BLAKE2b-256 |
1ff71b4af5551389cd725c2589ab3882fe260ff3aa3b3be4006555388136c3b5
|
File details
Details for the file redis_watcher-1.8.0-py3-none-any.whl.
File metadata
- Download URL: redis_watcher-1.8.0-py3-none-any.whl
- Upload date:
- Size: 403.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d470847b7c82a7ba692d1d9f3fbc483f3cacab3ebd398767d67986e30de299b
|
|
| MD5 |
8252e57a2920107480bac12c3ea460fe
|
|
| BLAKE2b-256 |
ef4d216e50171d009dc87f4497533fd63a5a9a6a13a7375fdae52d4a76b5b128
|