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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: casbin_redis_adapter-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 647456b87205a7d7168a18fd6adbfc981791a554d482358fd9c2b63ae065c695
MD5 f7b45d89310c54fa60da287b1a982682
BLAKE2b-256 a4a5d6ab687996fdbbe2a3a274de5ae6f4ee851af42e1df7f15c548eac2acc10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_redis_adapter-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0180322c31b15cc71e657950798710dc4f9b33eef46038ec7216a9eaa6c401d4
MD5 b0ec0492692c5adc2c26c94e87bb86b9
BLAKE2b-256 8c53895d04274c4513122d4020dbcbd2fc565f461633777c2ce9714eac96f4cf

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