Skip to main content

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

casbin_redis_adapter-1.0.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

casbin_redis_adapter-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file casbin_redis_adapter-1.0.0.tar.gz.

File metadata

  • Download URL: casbin_redis_adapter-1.0.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for casbin_redis_adapter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fb02dd224351a509a25b10d9668e7088e0f80ec63b4ae47d0373f0f753de6161
MD5 7559fc5c5da80ba2fb3508ce200d8f70
BLAKE2b-256 7be01707a02ed53880d6425e63c7f975d85abc7d1f08c0e98dfeb29e550920b2

See more details on using hashes here.

File details

Details for the file casbin_redis_adapter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for casbin_redis_adapter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c525d6b81d8ab0401d5ddcda0fa7bcd797282e3627b1d1c5b6c493ab262571c3
MD5 bd150f73746231a4e96d3fc72cd0aa62
BLAKE2b-256 e98627923146bded6d29d110eab7615c1b1ab651c9426138ce3e4710db466c5c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page