Skip to main content

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 casbin-redis-watcher

Simple Example

import os
import casbin
from casbin_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.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.

Release files for test-test782764782642 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-test782764782642 1.3.0
File Size Uploaded
test_test782764782642-1.3.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for test-test782764782642 1.3.0
File Interpreter ABI Platform
test_test782764782642-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / test_test782764782642-1.3.0.tar.gz

Download URL test_test782764782642-1.3.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d3283abe2796183335ceec061a98f2b4f13b75102033a0663ce26e808cbbcc67
BLAKE2b-256 checksum
How to use checksums
df22ca34c65a50066a694259078d1b238df0e5568cd0b8f1ee7745be458a2212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / test_test782764782642-1.3.0-py3-none-any.whl

Download URL test_test782764782642-1.3.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38df126d1b8940603d8cc7f6559229e3f3313cab7b859857b8bfbb0f2da087e0
BLAKE2b-256 checksum
How to use checksums
609f378943b81c02989139ec8e51067e2d9846ca57d6f0b1d75f7b2776edc577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page