Redis Adapter for PyCasbin
Project description
Redis Adapter for PyCasbin
Redis Adapter is the redis adapter for PyCasbin. With this library, Casbin can load policy from redis or save policy to it.
Installation
pip install casbin_redis_adapter
Simple Example
import casbin_redis_adapter
import casbin
adapter = casbin_redis_adapter.Adapter('localhost', 6379)
e = casbin.Enforcer('path/to/model.conf', adapter, True)
sub = "alice" # the user that wants to access a resource.
obj = "data1" # the resource that is going to be accessed.
act = "read" # the operation that the user performs on the resource.
if e.enforce(sub, obj, act):
# permit alice to read data1casbin_sqlalchemy_adapter
pass
else:
# deny the request, show an error
pass
Getting Help
License
This project is licensed under the Apache 2.0 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for casbin_redis_adapter-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647456b87205a7d7168a18fd6adbfc981791a554d482358fd9c2b63ae065c695 |
|
MD5 | f7b45d89310c54fa60da287b1a982682 |
|
BLAKE2b-256 | a4a5d6ab687996fdbbe2a3a274de5ae6f4ee851af42e1df7f15c548eac2acc10 |
Close
Hashes for casbin_redis_adapter-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0180322c31b15cc71e657950798710dc4f9b33eef46038ec7216a9eaa6c401d4 |
|
MD5 | b0ec0492692c5adc2c26c94e87bb86b9 |
|
BLAKE2b-256 | 8c53895d04274c4513122d4020dbcbd2fc565f461633777c2ce9714eac96f4cf |