Skip to main content

Redis Adapter for PyCasbin

Project description

Redis Adapter for PyCasbin

GitHub Actions Coverage Status Version PyPI - Wheel Pyversions Download License

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.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

casbin_redis_adapter-1.0.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: casbin_redis_adapter-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 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.1.tar.gz
Algorithm Hash digest
SHA256 1366d173fb037b04f794bc1d72041fbfaabda5f6294ad1dea2712c864adc04fb
MD5 692d63d0234a6dbd897da17e838399b6
BLAKE2b-256 6c5c83fe92cb91f4423f4890276e4779774a936a7881fd0eff6e74f5add677a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_redis_adapter-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ea407f0817ac4f65deaf140a86f9042f09503a2d8b7d4aa60d3fc468193005c
MD5 1babb6d0e080399eec1c9667d6d6dad8
BLAKE2b-256 753c9d8e3c3a8ba3f0ccd97cb4dd625de3389d6328a639cece17af6d39be31a2

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