{"id":15010046,"url":"https://github.com/pycasbin/redis-adapter","last_synced_at":"2025-06-20T07:34:24.493Z","repository":{"id":97653308,"uuid":"575896732","full_name":"pycasbin/redis-adapter","owner":"pycasbin","description":"Redis adapter for PyCasbin","archived":false,"fork":false,"pushed_at":"2024-03-29T11:20:22.000Z","size":24,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-25T12:02:31.250Z","etag":null,"topics":["abac","acl","adapter","auth","authorization","authz","casbin","py","pycasbin","python","rbac","redis"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/pycasbin","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pycasbin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-08T14:44:42.000Z","updated_at":"2024-02-18T05:30:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"4388a64b-b235-47a9-92bf-52dcbd09d3f4","html_url":"https://github.com/pycasbin/redis-adapter","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pycasbin/redis-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fredis-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fredis-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fredis-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fredis-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pycasbin","download_url":"https://codeload.github.com/pycasbin/redis-adapter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fredis-adapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260901352,"owners_count":23079751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abac","acl","adapter","auth","authorization","authz","casbin","py","pycasbin","python","rbac","redis"],"created_at":"2024-09-24T19:29:40.555Z","updated_at":"2025-06-20T07:34:19.478Z","avatar_url":"https://github.com/pycasbin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Redis Adapter for PyCasbin\n====\n\n[![GitHub Action](https://github.com/pycasbin/redis-adapter/workflows/build/badge.svg?branch=master)](https://github.com/pycasbin/redis-adapter/actions)\n[![Coverage Status](https://coveralls.io/repos/github/pycasbin/redis-adapter/badge.svg)](https://coveralls.io/github/pycasbin/redis-adapter)\n[![Version](https://img.shields.io/pypi/v/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)\n[![Download](https://img.shields.io/pypi/dm/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\nRedis Adapter is the [redis](https://redis.io/) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this\nlibrary, Casbin can load policy from redis or save policy to it.\n\n## Installation\n\n```\npip install casbin_redis_adapter\n```\n\n## Simple Example\n\n```python\nimport casbin_redis_adapter\nimport casbin\n\nadapter = casbin_redis_adapter.Adapter('localhost', 6379)\n\ne = casbin.Enforcer('path/to/model.conf', adapter, True)\n\nsub = \"alice\"  # the user that wants to access a resource.\nobj = \"data1\"  # the resource that is going to be accessed.\nact = \"read\"  # the operation that the user performs on the resource.\n\nif e.enforce(sub, obj, act):\n    # permit alice to read data1casbin_sqlalchemy_adapter\n    pass\nelse:\n    # deny the request, show an error\n    pass\n```\n\n## Configuration\n\n`Adapter()` enable decode_responses by default and supports any Redis parameter configuration.\n\nTo use casbin_redis_adapter, you must provide the following parameter configuration\n\n- `host`: address of the redis service\n- `port`: redis service port\n\nThe following parameters are provided by default\n\n- `db`: redis database, default is `0`\n- `username`: redis username, default is `None`\n- `password`: redis password, default is `None`\n- `key`: casbin rule to store key, default is `casbin_rules`\n\nFor more parameters, please follow [redis-py](https://redis.readthedocs.io/en/stable/connections.html#redis.Redis)\n\n### Getting Help\n\n- [PyCasbin](https://github.com/casbin/pycasbin)\n\n### License\n\nThis project is licensed under the [Apache 2.0 license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpycasbin%2Fredis-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpycasbin%2Fredis-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpycasbin%2Fredis-adapter/lists"}