Casbin role watcher to be used for monitoring updates to policies for PyCasbin
Project description
etcd-watcher
Etcd Watcher is the Etcd watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
Installation
pip install casbin-etcd-watcher
Simple Example
import casbin
from etcd_watcher import new_watcher
def update_callback_func(event):
...
watcher = new_watcher(endpoints=["localhost", 2379], keyname="/casbin")
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
License
This project is under Apache 2.0 License. See the LICENSE file for the full license text.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
casbin_etcd_watcher-1.1.0.tar.gz
(363.4 kB
view details)
Built Distribution
File details
Details for the file casbin_etcd_watcher-1.1.0.tar.gz
.
File metadata
- Download URL: casbin_etcd_watcher-1.1.0.tar.gz
- Upload date:
- Size: 363.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6001fa03dd78786a66ff4e5b687354801a8cb8c58a9c0ffd174c30066e36a6a5 |
|
MD5 | 6dde43796ab92af7f8259b96857dd38b |
|
BLAKE2b-256 | 7e32bfce7499f87ff731105511fd743e6823b2e78bc92c768f8903e040ad831d |
File details
Details for the file casbin_etcd_watcher-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: casbin_etcd_watcher-1.1.0-py3-none-any.whl
- Upload date:
- Size: 397.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 089c114a37495334a5642678cba849f0b6aa877a4606b1ce7d9f4062819ffe9d |
|
MD5 | b3ce05aab399222b32111673d6f303fa |
|
BLAKE2b-256 | ec74e9cb18a87eaa39f50467db5446c9ed7391d24d77c622181b47f5c1817e51 |